From 20b073d617450c7fad9e8200905432b0bf76cdf1 Mon Sep 17 00:00:00 2001 From: Yaki Date: Tue, 9 Jan 2024 06:32:56 -0800 Subject: [PATCH] Refactor useEffect dependencies to stop re-renders --- src/routes/overview.tsx | 3 ++- src/routes/staking.tsx | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/routes/overview.tsx b/src/routes/overview.tsx index 728da66..d1d3b60 100644 --- a/src/routes/overview.tsx +++ b/src/routes/overview.tsx @@ -277,7 +277,8 @@ const Overview = () => { } }); }; - }, [setupSubscriptions, selectedAccount, api]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedAccount, api]); return (
diff --git a/src/routes/staking.tsx b/src/routes/staking.tsx index 02ac614..dda3194 100644 --- a/src/routes/staking.tsx +++ b/src/routes/staking.tsx @@ -550,13 +550,15 @@ const Staking = () => { if (unsub) { unsub.then(unsubFunc => { if (typeof unsubFunc === 'function') { + console.log("Unsubscribing from subscription"); unsubFunc(); } }); } }); }; - }, [selectedAccount, setupSubscriptions, api]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedAccount, api]); return (