generated from ChainSafe/yarn-workspaces-typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Open
Copy link
Labels
Type: EnhancementAdded to issues and PRs when a change includes improvements or optimizations.Added to issues and PRs when a change includes improvements or optimizations.
Description
For useSprinterTokens, useSprinterChains and useSprinterBalances, we request users to call a corresponding getter function such as getUserBalances in a useEffect.
I'd propose to remove this, or to call it refresh, and to actually call the relevant function right on load.
e.g users could have:
const { balances, error, isLoading, refresh } = useSprinterBalances('0x123..')
if (isLoading) return <Loader />
if (!!error) return <div>Something went wrong {error}<div>
return <div>balances.length</div>on address change (in useSprinterBalances), the balances would be refetched, and if the users for some reason want to programmatically refresh, they can call the refresh.
This is more in line with the hooks I'm used to use. WDYT @BeroBurny @saadahmsiddiqui ?
Metadata
Metadata
Assignees
Labels
Type: EnhancementAdded to issues and PRs when a change includes improvements or optimizations.Added to issues and PRs when a change includes improvements or optimizations.