Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
refactor(react): spread manager.wallets in wallets array
Browse files Browse the repository at this point in the history
  • Loading branch information
drichar committed Jan 9, 2024
1 parent b3dcd0f commit 772fe24
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/use-wallet-react/src/useWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ export function useWallet() {
const walletStateMap = useStore(manager.store, (state) => state.wallets)
const activeWalletId = useStore(manager.store, (state) => state.activeWallet)

const walletsArray = React.useMemo(() => [...manager.wallets.values()], [manager])

const wallets = React.useMemo(() => {
return walletsArray.map((wallet): Wallet => {
return [...manager.wallets.values()].map((wallet): Wallet => {
const walletState = walletStateMap[wallet.id]

return {
Expand All @@ -46,7 +44,7 @@ export function useWallet() {
setActiveAccount: (addr) => wallet.setActiveAccount(addr)
}
})
}, [walletsArray, walletStateMap, activeWalletId])
}, [manager, walletStateMap, activeWalletId])

const activeWallet = activeWalletId ? manager.getWallet(activeWalletId) || null : null
const activeWalletState = activeWalletId ? walletStateMap[activeWalletId] || null : null
Expand Down

0 comments on commit 772fe24

Please sign in to comment.