File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed
packages/thirdweb/src/react/core/providers Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Fix query invalidation when using react hooks
Original file line number Diff line number Diff line change @@ -47,22 +47,25 @@ export function ThirdwebProvider(props: React.PropsWithChildren) {
47
47
console . error ( "[Transaction Error]" , e ) ;
48
48
} )
49
49
. then ( ( ) => {
50
- return queryClient . invalidateQueries ( {
51
- queryKey : [
52
- // invalidate any readContract queries for this chainId:contractAddress
53
- [
54
- "readContract" ,
55
- variables . __contract ?. chain . id ,
56
- variables . __contract ?. address ,
57
- ] as const ,
50
+ return Promise . all ( [
51
+ queryClient . invalidateQueries ( {
52
+ queryKey :
53
+ // invalidate any readContract queries for this chainId:contractAddress
54
+ [
55
+ "readContract" ,
56
+ variables . __contract ?. chain . id ,
57
+ variables . __contract ?. address ,
58
+ ] as const ,
59
+ } ) ,
60
+ queryClient . invalidateQueries ( {
58
61
// invalidate any walletBalance queries for this chainId
59
62
// TODO: add wallet address in here if we can get it somehow
60
- [
63
+ queryKey : [
61
64
"walletBalance" ,
62
65
variables . __contract ?. chain . id ,
63
66
] as const ,
64
- ] ,
65
- } ) ;
67
+ } ) ,
68
+ ] ) ;
66
69
} ) ;
67
70
}
68
71
}
You can’t perform that action at this time.
0 commit comments