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
|
// but right now this toast is noisy for optimistic zaps
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}, [act, toaster, strike, wallets.length])
|
}, [act, toaster, strike, wallets])
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ActCanceledError extends Error {
|
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,
|
// provides priority sorted wallets to children, a function to reload local wallets,
|
||||||
// and a function to set priorities
|
// and a function to set priorities
|
||||||
|
const value = useMemo(() => ({
|
||||||
|
wallets,
|
||||||
|
reloadLocalWallets,
|
||||||
|
setPriorities,
|
||||||
|
onVaultKeySet: syncLocalWallets,
|
||||||
|
beforeDisconnectVault: unsyncLocalWallets,
|
||||||
|
removeLocalWallets
|
||||||
|
}), [wallets, reloadLocalWallets, setPriorities, syncLocalWallets, unsyncLocalWallets, removeLocalWallets])
|
||||||
return (
|
return (
|
||||||
<WalletsContext.Provider
|
<WalletsContext.Provider value={value}>
|
||||||
value={{
|
|
||||||
wallets,
|
|
||||||
reloadLocalWallets,
|
|
||||||
setPriorities,
|
|
||||||
onVaultKeySet: syncLocalWallets,
|
|
||||||
beforeDisconnectVault: unsyncLocalWallets,
|
|
||||||
removeLocalWallets
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<RetryHandler>
|
<RetryHandler>
|
||||||
{children}
|
{children}
|
||||||
</RetryHandler>
|
</RetryHandler>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user