Skip to content

Commit

Permalink
update cleanup func
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennievon committed Dec 15, 2023
1 parent 9ace858 commit ae24f51
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,14 @@ export const WalletConnectionProvider = ({
setProvider(providerInstance);
initialize(providerInstance);

ethereum.on("accountsChanged", () => {
fetchUserAccounts();
});
ethereum.on("accountsChanged", fetchUserAccounts);
} else {
setLoading(false);
}

return () => {
if (ethereum && ethereum.removeListener) {
ethereum.removeListener("accountsChanged", () => {
fetchUserAccounts();
});
ethereum.removeListener("accountsChanged", fetchUserAccounts);
}
};
}, []);
Expand Down

0 comments on commit ae24f51

Please sign in to comment.