refactor: [M3-8462] - Upgrade to TanStack Query v5#10804
refactor: [M3-8462] - Upgrade to TanStack Query v5#10804bnussman-akamai merged 7 commits intolinode:developfrom
Conversation
jaalah-akamai
left a comment
There was a problem hiding this comment.
Thank you for the effort in doing this 🚀
| return page + 1; | ||
| }, | ||
| keepPreviousData: true, | ||
| initialPageParam: 1, |
There was a problem hiding this comment.
Should we use placeholderData here? I'll test this part of the Parent/Child code shortly.
There was a problem hiding this comment.
I don't think we need keepPreviousData / placeholderData on an infinite query, but I will double check this.
| headers: options.headers, | ||
| params: { | ||
| page: pageParam, | ||
| page: pageParam as number, |
There was a problem hiding this comment.
Nit: Couldn't we type pageParam as queryFn: ({ pageParam }: { pageParam: number }) =>? I'm kinda interested why it's defined as unknown
There was a problem hiding this comment.
Yeah, that would also work. I can't really find a way to make pageParam any more type-safe. It seems like with either solution, it can't be strongly typed in the factory or in the query 🫤
| } | ||
| }, [query.error]); | ||
|
|
||
| return query; |
There was a problem hiding this comment.
cc: @venkymano for transparency - just letting you know of the change
|
Coverage Report: ❌ |
dwiley-akamai
left a comment
There was a problem hiding this comment.
Still a bit more testing and a few more files I want to take a closer look, but it's looking good so far:
CRUD operations for Linodes, Volumes, VPC, Firewalls, Domains, Databases, Kubernetes ✅
|
|
||
| // Update the user's grants directly in the cache | ||
| this.props.queryClient.setQueriesData<Grants>( | ||
| this.props.queryClient.setQueryData<Grants>( |
There was a problem hiding this comment.
From here:
Is the reason for shifting to setQueryData that we're updating a single query and not matching the query key partially?
There was a problem hiding this comment.
Yeah exactly. I think setQueriesData was accidentally used here

Description 📝
latest📦Main Changes 🔁
isPendinginstead ofisLoadingto track if a mutation is executingkeepPreviousData(an option we use to prevent flickering on paginated endpoints) is no longer a useQuery option. We now use must useplaceholderDatawith thekeepPreviousDatahelper.initialPageParamis now a required option on Infinite QueriesPreview 📷
How to test 🧪
As an Author I have considered 🤔