Skip to content

Commit

Permalink
Fix zustand warning (#872)
Browse files Browse the repository at this point in the history
* Fix zustand warning

* use useStoreWithEqualityFn

* eslint
  • Loading branch information
Benjythebee authored Aug 3, 2023
1 parent 505e164 commit 634d146
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@web3-react/store": "^8.2.0",
"@web3-react/types": "^8.2.0",
"zustand": "^4.3.5"
"zustand": "4.4.0"
},
"peerDependencies": {
"react": ">=16.8"
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createWeb3ReactStoreAndActions } from '@web3-react/store'
import type { Actions, Connector, Web3ReactState, Web3ReactStore } from '@web3-react/types'
import { useEffect, useMemo, useState } from 'react'
import { useStore } from 'zustand'
import { useStoreWithEqualityFn } from 'zustand/traditional'

let DynamicProvider: typeof Web3Provider | null | undefined
async function importProvider(): Promise<void> {
Expand Down Expand Up @@ -260,7 +261,7 @@ function getStateHooks(store: Web3ReactStore) {
}

function useAccounts(): Web3ReactState['accounts'] {
return useStore(store, ACCOUNTS, ACCOUNTS_EQUALITY_CHECKER)
return useStoreWithEqualityFn(store, ACCOUNTS, ACCOUNTS_EQUALITY_CHECKER)
}

function useIsActivating(): Web3ReactState['activating'] {
Expand Down
2 changes: 1 addition & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"dependencies": {
"@ethersproject/address": "^5",
"@web3-react/types": "^8.2.0",
"zustand": "^4.3.5"
"zustand": "4.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"start": "tsc --watch"
},
"dependencies": {
"zustand": "^4.3.5"
"zustand": "4.4.0"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10115,9 +10115,9 @@ yargs@^17.6.2:
y18n "^5.0.5"
yargs-parser "^21.1.1"

zustand@^4.3.5:
version "4.3.6"
resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.3.6.tgz#ce7804eb75361af0461a2d0536b65461ec5de86f"
integrity sha512-6J5zDxjxLE+yukC2XZWf/IyWVKnXT9b9HUv09VJ/bwGCpKNcaTqp7Ws28Xr8jnbvnZcdRaidztAPsXFBIqufiw==
zustand@4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.4.0.tgz#13b3e8ca959dd53d536034440aec382ff91b65c3"
integrity sha512-2dq6wq4dSxbiPTamGar0NlIG/av0wpyWZJGeQYtUOLegIUvhM2Bf86ekPlmgpUtS5uR7HyetSiktYrGsdsyZgQ==
dependencies:
use-sync-external-store "1.2.0"

0 comments on commit 634d146

Please sign in to comment.