refactor: migrate react-query v3 → @tanstack/react-query v5#952
Merged
Conversation
Removes the legacy react-query v3 package (unmaintained), consolidating
on @tanstack/react-query v5 which was already a dependency. A prior
migration attempt had been started and abandoned (commented-out TanStack
provider in App.tsx).
Provider strategy: App.tsx keeps its configured QueryClient but now
imports it from @tanstack/react-query. The wagmi Web3Provider already
wraps the app with its own TanStack v5 client higher in the tree; both
clients are valid v5, so all 45 hooks resolve to App's nearest provider
and defaultOptions are preserved exactly. (Unifying to a single client
is deferred — would alter wagmi's internal query behavior.)
Changes:
- 26 useQuery call sites: positional (key, fn, opts) → object form
- 19 useMutation call sites: positional (fn, opts) → object form
- cacheTime → gcTime (App.tsx + 4 hooks)
- keepPreviousData → placeholderData: keepPreviousData (useAllDAOs)
- useEvmProposalOps: 8 positional invalidateQueries(["k"]) →
invalidateQueries({ queryKey: ["k"] }) — silent runtime break in v5
- All query keys were already arrays (v5-compatible); no useInfiniteQuery
- onSuccess on mutations and resetQueries() no-arg are unchanged in v5
- Removed "react-query" from package.json
yarn build, tsc --noEmit, lint:check all green. Unit tests: same 2
pre-existing jsdom-env failures, no new regressions.
✅ Deploy Preview for tezos-homebase ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Removes the legacy
react-queryv3 package (unmaintained), consolidating on@tanstack/react-queryv5 — which was already a dependency, used by the wagmi provider. A prior migration attempt had been started and abandoned (a commented-out TanStack provider inApp.tsx); this completes it.Net: 45 files migrated,
react-queryremoved from the dependency tree (-471/+322 lines, mostly the lockfile shrinking).Provider strategy (lowest-risk)
App.tsxkeeps its configuredQueryClient(with the project'sdefaultOptions) but now imports it from@tanstack/react-query. The wagmiWeb3Provideralready wraps the whole app with its own TanStack v5 client higher in the tree, so both clients are valid v5 and every hook resolves to App's nearest provider —defaultOptionspreserved exactly. Unifying to a single client is deferred (it would change wagmi's internal query behavior, risking wallet flows).Changes
useQuerycall sites: positional(key, fn, opts)→ object{ queryKey, queryFn, ...opts }useMutationcall sites: positional(fn, opts)→ object{ mutationFn, ...opts }cacheTime→gcTime(App.tsx + 4 hooks)keepPreviousData: true→placeholderData: keepPreviousData(useAllDAOs)useEvmProposalOps: 8 positionalinvalidateQueries(["k"])→invalidateQueries({ queryKey: ["k"] })— this is a silent runtime break in v5 (positional args are ignored), so it's the highest-value fix to verifyuseInfiniteQuery;onSuccesson mutations andresetQueries()no-arg are unchanged in v5Test plan
yarn install—react-querygone from treenpx tsc --noEmit— greenyarn build— greenyarn lint:check— greenyarn test:unit— same 2 pre-existing jsdom-env failures, no new regressionsuseAllDAOsplaceholderData), proposal auto-refetch (useProposals), voting (useVote), treasury/balances, lite polls, Etherlink proposal create/execute → confirm member/proposal lists refresh (validates theinvalidateQueriesfix), wallet connect/disconnect