fix: reset to defaultTokens when chain changes (#6154)

This commit is contained in:
eddie 2023-03-14 11:18:50 -07:00 committed by GitHub
parent 645d92185a
commit acc6b0a740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,14 +74,10 @@ export function useSyncWidgetInputs({
useEffect(() => {
if (chainId !== previousChainId && !!previousChainId && isSupportedChain(chainId)) {
setTokens({
...tokens,
[Field.INPUT]: undefined,
[Field.OUTPUT]: undefined,
})
setTokens(defaultTokens)
setAmount(EMPTY_AMOUNT)
}
}, [chainId, previousChainId, tokens])
}, [chainId, defaultTokens, previousChainId, tokens])
const onAmountChange = useCallback(
(field: Field, amount: string, origin?: 'max') => {