Bug in handleChainChanged
rootulp opened this issue · 2 comments
I observed a bug while auditing this code. handleChainChanged
currently doesn't dispatch a SET_CHAIN_ID
action. It looks like a copy + paste mistake from handleAccountsChanged
web3modal-example/pages/index.tsx
Lines 174 to 180 in e4cae61
Per https://docs.ethers.io/v5/concepts/best-practices/#best-practices--network-changes I think it would be preferable to hard refresh the website if the chain changes. Happy to create a PR for this. The diff looks like:
// https://docs.ethers.io/v5/concepts/best-practices/#best-practices--network-changes
const handleChainChanged = (_hexChainId: string) => {
window.location.reload();
}
@rootulp Oh yes, thanks for catching that. Indeed looks like a copy/paste mistake! A PR would be much appreciated.
I've actually patched this up just now, also updated the dependencies for the repo. Thanks again for the help!