Skip to content

Commit 47af746

Browse files
committed
feat(neuron-ui): clear send view on wallet switching
1 parent aaec8c2 commit 47af746

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const clear = (dispatch: StateDispatch) => {
168168
const useClear = (dispatch: StateDispatch) => useCallback(() => clear(dispatch), [dispatch])
169169

170170
export const useInitialize = (
171+
walletID: string,
171172
items: TransactionOutput[],
172173
generatedTx: any | null,
173174
dispatch: React.Dispatch<any>,
@@ -187,6 +188,10 @@ export const useInitialize = (
187188
const onSubmit = useOnSubmit(items, dispatch)
188189
const onClear = useClear(dispatch)
189190

191+
useEffect(() => {
192+
clear(dispatch)
193+
}, [walletID, dispatch])
194+
190195
const onGetAddressErrorMessage = useCallback(
191196
(addr: string) => {
192197
if (addr === '') {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const Send = ({
5757
onGetAddressErrorMessage,
5858
onGetAmountErrorMessage,
5959
onClear,
60-
} = useInitialize(send.outputs, send.generatedTx, dispatch, t)
60+
} = useInitialize(walletID, send.outputs, send.generatedTx, dispatch, t)
6161
useOnTransactionChange(walletID, send.outputs, send.price, dispatch, setIsTransactionValid, setTotalAmount)
6262
const leftStackWidth = '70%'
6363
const labelWidth = '140px'

0 commit comments

Comments
 (0)