fix: spdv-971 (#211)

* fix: spdv-971

* fix: spdv-971
This commit is contained in:
rolandlor
2026-03-04 11:56:03 +01:00
committed by Bálint Ujvári
parent 3ff645cab1
commit e00918b192
2 changed files with 17943 additions and 20 deletions
+17927
View File
File diff suppressed because it is too large Load Diff
@@ -114,16 +114,19 @@ export function InitialModal({
const handleCostFetch = useCallback(
(cost: BZZ) => {
safeSetState(isMountedRef, setIsNodeSyncing)(false)
setIsNodeSyncing(false)
checkBalances(cost)
safeSetState(isMountedRef, setCost)(cost.toSignificantDigits(2))
const costDecimal = parseFloat(cost.toDecimalString())
const formattedCost =
costDecimal < 0.01 && costDecimal > 0 ? costDecimal.toExponential(1) : costDecimal.toPrecision(2)
setCost(formattedCost)
},
[checkBalances],
)
const handleCostFetchError = useCallback(() => {
safeSetState(isMountedRef, setIsNodeSyncing)(true)
safeSetState(isMountedRef, setCost)('0')
setIsNodeSyncing(true)
setCost('0')
}, [])
const createAdminDrive = useCallback(async () => {
@@ -195,26 +198,19 @@ export function InitialModal({
currentFetch,
handleCostFetchError,
)
} else {
setCost('0')
setIsCreateEnabled(false)
}
}, [validityEndDate, erasureCodeLevel, beeApi, capacity, handleCostFetch, handleCostFetchError])
useEffect(() => {
if (lifetimeIndex >= 0 && !isNodeSyncing) {
setIsCreateEnabled(true)
} else {
setIsCreateEnabled(false)
}
} else {
setCost('0')
setIsCreateEnabled(false)
}
}, [
validityEndDate,
erasureCodeLevel,
beeApi,
capacity,
lifetimeIndex,
isNodeSyncing,
handleCostFetch,
handleCostFetchError,
])
}, [lifetimeIndex, isNodeSyncing])
useEffect(() => {
setValidityEndDate(getExpiryDateByLifetime(lifetimeIndex))