From 6a677364e4588c78d5002d69ac811fcd0c268dba Mon Sep 17 00:00:00 2001 From: Fionna Chan <13184582+fionnachan@users.noreply.github.com> Date: Mon, 9 Sep 2024 23:18:18 +0800 Subject: [PATCH] fix: re-enable move funds button after transfer (#1875) --- .../TransferPanel/TransferPanelMainInput.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMainInput.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMainInput.tsx index a58e79aec7..647bb64bf8 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMainInput.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/TransferPanelMainInput.tsx @@ -224,6 +224,15 @@ export const TransferPanelMainInput = React.memo( const [localValue, setLocalValue] = useState(value) useEffect(() => { + /** + * If value is empty, set localValue to empty string + * this is useful when transfer was successful and the `amount` query param + * was reset to an empty string + */ + if (value === '') { + setLocalValue('') + } + if (!isMaxAmount || !maxAmount) { return } @@ -233,7 +242,7 @@ export const TransferPanelMainInput = React.memo( * If user types anything before we receive the amount, isMaxAmount is set to false in the parent */ setLocalValue(maxAmount) - }, [isMaxAmount, maxAmount]) + }, [isMaxAmount, maxAmount, value]) const handleMaxButtonClick: React.MouseEventHandler = useCallback(