Use wallets instead of wallets.length as useZap dependency (#2088)
* Potential fix for stale useZap wallet dependency * Memoize context value for wallets
This commit is contained in:
parent
52365c32ed
commit
a7245930c2
@ -327,7 +327,7 @@ export function useZap () {
|
||||
// but right now this toast is noisy for optimistic zaps
|
||||
console.error(error)
|
||||
}
|
||||
}, [act, toaster, strike, wallets.length])
|
||||
}, [act, toaster, strike, wallets])
|
||||
}
|
||||
|
||||
export class ActCanceledError extends Error {
|
||||
|
@ -196,17 +196,16 @@ export function WalletsProvider ({ children }) {
|
||||
|
||||
// provides priority sorted wallets to children, a function to reload local wallets,
|
||||
// and a function to set priorities
|
||||
const value = useMemo(() => ({
|
||||
wallets,
|
||||
reloadLocalWallets,
|
||||
setPriorities,
|
||||
onVaultKeySet: syncLocalWallets,
|
||||
beforeDisconnectVault: unsyncLocalWallets,
|
||||
removeLocalWallets
|
||||
}), [wallets, reloadLocalWallets, setPriorities, syncLocalWallets, unsyncLocalWallets, removeLocalWallets])
|
||||
return (
|
||||
<WalletsContext.Provider
|
||||
value={{
|
||||
wallets,
|
||||
reloadLocalWallets,
|
||||
setPriorities,
|
||||
onVaultKeySet: syncLocalWallets,
|
||||
beforeDisconnectVault: unsyncLocalWallets,
|
||||
removeLocalWallets
|
||||
}}
|
||||
>
|
||||
<WalletsContext.Provider value={value}>
|
||||
<RetryHandler>
|
||||
{children}
|
||||
</RetryHandler>
|
||||
|
Loading…
x
Reference in New Issue
Block a user