pages undefined on SuspenseInfiniteQuery in v5
Hey all,
I've started migrating from React Router to Tanstack router and fixed to refactor the fetching as well. Got one issue atm with the
useSuspenseInfiniteQuery
And ProjectsList.tsx:54
is this:
and the query is fairly standard too where we just fetch an API endpoint. next and prev pages are from documentation and doesn't change anything if I hardcode it.
Have an ongoing PR here, simply ignore everything changed in src/app
directories as that's pre-migration stuff
https://github.com/packit/dashboard/pull/435/filesGitHub
feat: Initial routing refactor to TanStack Router by Venefilyn · Pu...
This is part of the huge redesign of the frontend website where we will separate routing from components in an easier way to allow us to find routes a lot easier within the codebase. As a bonus wit...


13 Replies
unwilling-turquoiseOP•15mo ago
Also regards to the devtools it has the wrong format AFAIK in the data explorer since it's supposed to be infinite. Refetch makes it correct. Also please at-me when replying initially so I can see the thread 😄


unwilling-turquoiseOP•15mo ago
I feel like it's a simple issue as a refetch fixes the issue. But I can't figure it out
unwilling-turquoiseOP•15mo ago
I get a TS error about this but I have defined queryClient in the Tanstack Router so not sure what is going on

unwilling-turquoiseOP•15mo ago
Also posted here
https://github.com/TanStack/query/discussions/7687
GitHub
pages
are undefined
on useSuspenseInfiniteQuery in v5 · TanStac...Hi all While migrating from React Router to TanStack Router in packit/dashboard#435 I also decided to refactor our usage of TanStack Query (and upgrade it from v4 to v5) Problem is that I can't...
unwilling-turquoiseOP•15mo ago
See posts tab here to get error https://stackblitz.com/edit/tanstack-router-y2tk7l?file=src%2Fposts.tsx
Freya Gustavsson
StackBlitz
Router Basic React Query File Based Example (forked) - StackBlitz
Run official live example code for Router Basic React Query File Based, created by Tanstack on StackBlitz
unwilling-turquoiseOP•15mo ago
Even simpler sandbox
https://codesandbox.io/p/sandbox/dank-dew-5g5w8r
unwilling-turquoiseOP•15mo ago
Just feels like a bug and I can't fix it with my own code, reported it here
https://github.com/TanStack/query/issues/7693
GitHub
useSuspenseInfiniteQuery
does not create correct data · Issue #76...Describe the bug When going to a page that has useSuspenseInfiniteQuery it does not show the data as it should. Instead it feels like TanStack takes a normal query and hands it off as-is to the Inf...
extended-salmon•15mo ago
["projects"]
is an infinite query, but you prefetch it with prefetchQuery
. That puts the wrong structure in the cache. You need to prefetch it with prefetchInfiniteQuery
unwilling-turquoiseOP•15mo ago
Hmm. I don't have that in my project. Leftover from the playground fork
I can remove and try again to get the issue I have at my project
Or does Router prefetch? Can't get it to work..
unwilling-turquoiseOP•15mo ago
Like with this here there isn't anything with prefetch https://github.com/packit/dashboard/pull/435
GitHub
feat: Initial routing refactor to TanStack Router by Venefilyn · Pu...
This is part of the huge redesign of the frontend website where we will separate routing from components in an easier way to allow us to find routes a lot easier within the codebase. As a bonus wit...
extended-salmon•15mo ago
if you remove the prefetch it works fine
Like with this here there isn't anything with prefetchlook at the devtools to see what's in the cache. could be that you re-use the same key between a query and an infinite query
unwilling-turquoiseOP•15mo ago
Only ever one query being executed from the devtools as seen here
extended-salmon•15mo ago
yes but what data is in it