Skip to content

Commit 664128a

Browse files
committed
fix: add query client initialization and invalidate queries in useSyncAccountWithUserStore
1 parent d956d68 commit 664128a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/hooks/useSyncAccountWithUserStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { SUPPORTED_CHAINS } from '@/config';
2+
import { useQueryClient } from '@tanstack/react-query';
23
import { useEffect } from 'react';
34
import { useAccount } from 'wagmi';
45
import useUserStore from '@/stores/useUser.store';
@@ -12,6 +13,7 @@ export function useSyncAccountWithUserStore() {
1213
setChainId,
1314
setSubgraphUrl,
1415
} = useUserStore();
16+
const queryClient = useQueryClient();
1517

1618
useEffect(() => {
1719
// Update userStore
@@ -22,6 +24,7 @@ export function useSyncAccountWithUserStore() {
2224
const currentChain = SUPPORTED_CHAINS.find((c) => c.id === chain?.id);
2325
if (currentChain) {
2426
setSubgraphUrl(currentChain?.subgraphUrl);
27+
queryClient.invalidateQueries({ queryKey: [] });
2528
}
2629
}, [
2730
connector,
@@ -34,5 +37,6 @@ export function useSyncAccountWithUserStore() {
3437
setAddress,
3538
setChainId,
3639
setSubgraphUrl,
40+
queryClient,
3741
]);
3842
}

0 commit comments

Comments
 (0)