document useQueryCacheInvalidator
explains why `chainId` is pulled directly from the store.
This commit is contained in:
parent
491c9b4fd3
commit
631c202c49
@ -8,8 +8,13 @@ import { useActiveWeb3React } from '../../hooks/web3'
|
||||
import { updateBlockNumber, updateChainId } from './actions'
|
||||
|
||||
function useQueryCacheInvalidator() {
|
||||
const chainId = useAppSelector((state) => state.application.chainId)
|
||||
const dispatch = useAppDispatch()
|
||||
|
||||
// subscribe to `chainId` changes in the redux store rather than Web3
|
||||
// this will ensure that when `invalidateTags` is called, the latest
|
||||
// `chainId` is available in redux to build the subgraph url
|
||||
const chainId = useAppSelector((state) => state.application.chainId)
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(api.util.invalidateTags([CHAIN_TAG]))
|
||||
|
Loading…
Reference in New Issue
Block a user