Skip to content

Commit 21fd5b1

Browse files
committed
feat(neuron-ui): show local error message ahead of remote error message
1 parent 7bf6dbc commit 21fd5b1

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

packages/neuron-ui/src/components/Send/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const useOnTransactionChange = (
9999
})
100100
}
101101
}, 300)
102-
}, [walletID, items, price, dispatch, setTotalAmount])
102+
}, [walletID, items, price, dispatch, setTotalAmount, setErrorMessage])
103103
}
104104

105105
const useOnSubmit = (items: TransactionOutput[], dispatch: StateDispatch) =>

packages/neuron-ui/src/components/Send/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ const Send = ({
6262
const leftStackWidth = '70%'
6363
const labelWidth = '140px'
6464

65-
let errorMessageUnderTotal = errorMessage
66-
if (!errorMessageUnderTotal && !verifyTotalAmount(totalAmount, fee, balance)) {
67-
errorMessageUnderTotal = t(`messages.codes.${ErrorCode.AmountNotEnough}`)
68-
}
65+
const errorMessageUnderTotal = verifyTotalAmount(totalAmount, fee, balance)
66+
? errorMessage
67+
: t(`messages.codes.${ErrorCode.AmountNotEnough}`)
6968

7069
return (
7170
<Stack verticalFill tokens={{ childrenGap: 15, padding: '20px 0 0 0' }}>

0 commit comments

Comments
 (0)