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( const handleCostFetch = useCallback(
(cost: BZZ) => { (cost: BZZ) => {
safeSetState(isMountedRef, setIsNodeSyncing)(false) setIsNodeSyncing(false)
checkBalances(cost) 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], [checkBalances],
) )
const handleCostFetchError = useCallback(() => { const handleCostFetchError = useCallback(() => {
safeSetState(isMountedRef, setIsNodeSyncing)(true) setIsNodeSyncing(true)
safeSetState(isMountedRef, setCost)('0') setCost('0')
}, []) }, [])
const createAdminDrive = useCallback(async () => { const createAdminDrive = useCallback(async () => {
@@ -195,26 +198,19 @@ export function InitialModal({
currentFetch, currentFetch,
handleCostFetchError, handleCostFetchError,
) )
if (lifetimeIndex >= 0 && !isNodeSyncing) {
setIsCreateEnabled(true)
} else {
setIsCreateEnabled(false)
}
} else { } else {
setCost('0') setCost('0')
setIsCreateEnabled(false) setIsCreateEnabled(false)
} }
}, [ }, [validityEndDate, erasureCodeLevel, beeApi, capacity, handleCostFetch, handleCostFetchError])
validityEndDate,
erasureCodeLevel, useEffect(() => {
beeApi, if (lifetimeIndex >= 0 && !isNodeSyncing) {
capacity, setIsCreateEnabled(true)
lifetimeIndex, } else {
isNodeSyncing, setIsCreateEnabled(false)
handleCostFetch, }
handleCostFetchError, }, [lifetimeIndex, isNodeSyncing])
])
useEffect(() => { useEffect(() => {
setValidityEndDate(getExpiryDateByLifetime(lifetimeIndex)) setValidityEndDate(getExpiryDateByLifetime(lifetimeIndex))