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:
ekzyis 2025-04-09 22:53:31 +02:00 committed by GitHub
parent 52365c32ed
commit a7245930c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View File

@ -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 {

View File

@ -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>