Skip to content

Commit

Permalink
Delay setting current config after switching chain to ensure proper s…
Browse files Browse the repository at this point in the history
…tate update
  • Loading branch information
Da-Colon committed Dec 12, 2024
1 parent c05f818 commit 23cab88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/utils/useAutomaticSwitchChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
};

0 comments on commit 23cab88

Please sign in to comment.