From 23cab883962eaf93a62bd8fb23f73fb0cec524dd Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Thu, 12 Dec 2024 00:50:03 -0500 Subject: [PATCH] Delay setting current config after switching chain to ensure proper state update --- src/hooks/utils/useAutomaticSwitchChain.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/utils/useAutomaticSwitchChain.ts b/src/hooks/utils/useAutomaticSwitchChain.ts index 2459cc18e..ec7cd394a 100644 --- a/src/hooks/utils/useAutomaticSwitchChain.ts +++ b/src/hooks/utils/useAutomaticSwitchChain.ts @@ -25,9 +25,9 @@ export const useAutomaticSwitchChain = ({ return; } const chainId = getChainIdFromPrefix(urlAddressPrefix); - setCurrentConfig(getConfigByChainId(chainId)); if (addressPrefix !== urlAddressPrefix && urlAddressPrefix !== undefined) { switchChain({ chainId }); } + setTimeout(() => setCurrentConfig(getConfigByChainId(chainId)), 300); }, [addressPrefix, setCurrentConfig, getConfigByChainId, urlAddressPrefix, switchChain]); };