Skip to content

Commit

Permalink
Merge pull request #34 from InvArch:yaki-sub-rerender-fix
Browse files Browse the repository at this point in the history
Refactor useEffect dependencies to stop re-renders
  • Loading branch information
shibatales authored Jan 9, 2024
2 parents 7a4c6bd + 20b073d commit d46879c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/routes/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ const Overview = () => {
}
});
};
}, [setupSubscriptions, selectedAccount, api]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedAccount, api]);

return (
<div className="mx-auto w-full flex max-w-7xl flex-col justify-between p-4 sm:px-6 lg:px-8 mt-14 md:mt-0 gap-3">
Expand Down
4 changes: 3 additions & 1 deletion src/routes/staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="mx-auto w-full flex max-w-7xl flex-col justify-between p-4 sm:px-6 lg:px-8 mt-14 md:mt-0 gap-3">
Expand Down

0 comments on commit d46879c

Please sign in to comment.