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(