From 17251a3b5c76ae716da4c7f1e0de61bb15c484e8 Mon Sep 17 00:00:00 2001 From: tomjeatt <40243778+tomjeatt@users.noreply.github.com> Date: Wed, 24 May 2023 14:46:32 +0100 Subject: [PATCH] refactor: reset selected account on account change (#1226) --- .../CrossChainTransferForm/CrossChainTransferForm.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/Transfer/CrossChainTransferForm/CrossChainTransferForm.tsx b/src/pages/Transfer/CrossChainTransferForm/CrossChainTransferForm.tsx index 85b5cd0eb1..1e7a864185 100644 --- a/src/pages/Transfer/CrossChainTransferForm/CrossChainTransferForm.tsx +++ b/src/pages/Transfer/CrossChainTransferForm/CrossChainTransferForm.tsx @@ -212,6 +212,14 @@ const CrossChainTransferForm = (): JSX.Element => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [accountId, destinationChains]); + // TODO: When we refactor account select this should be handled there so + // that it's consitent across the application + useEffect(() => { + if (!accountId) return; + form.setFieldValue(CROSS_CHAIN_TRANSFER_TO_ACCOUNT_FIELD, accountId?.toString()); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [accountId]); + if (!originatingChains || !destinationChains || !transferableTokens.length) { return (