-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
Describe the bug
When an error occurs in useInfiniteQuery + experimental_prefetchInRender and the error boundary is subsequently reset, the data never finishes loading.
It does work correctly if I switch to using useSuspenseInfiniteQuery. I would expect both of these hooks to behave the same.
Screen.Recording.2025-12-02.at.16.13.18.mov
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-query-s4bncekk?file=src%2Fcomponents%2FProjects.tsx&preset=node
Steps to reproduce
- Click "Show Projects" (fetches first page which results in an error)
- Click "Try again"
// ❌ When error boundary is reset, it never finishes loading.
const { promise } = useInfiniteQuery({
queryKey: ['projects'],
queryFn: fetchProjects,
experimental_prefetchInRender: true,
});
const data = React.use(promise);
// // ✅ When error boundary is reset, it does finish loading.
// const { data } = useSuspenseInfiniteQuery({
// queryKey: ['projects'],
// queryFn: fetchProjects,
// experimental_prefetchInRender: true,
// });Expected behavior
- I would expect the data to finish loading.
- I would expect both of these hooks to behave the same.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
N/A
Tanstack Query adapter
None
TanStack Query version
5.90.11
TypeScript version
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels