Maximum update depth exceeded
Describe the bug
I am getting the error "Maximum update depth exceeded"
Your minimal, reproducible example
https://stackblitz.com/~/github.com/yWilliamLima/test-error
Steps to reproduce
It usually occurs after a while of running whenever changing pages/routes
Expected behavior
Do not return this error
How often does this bug happen?
Sometimes
Screenshots or Videos
Platform
OS: Windows 11 Browser: Chrome Node: 22.12.0
Tanstack Query adapter
None
TanStack Query version
5.66.5
TypeScript version
5.7.3
Additional context
The error in the console does not occur locally, only in stackblitz Maybe because of this error in the stackblitz console it doesn't happen, because it gives a refresh Because it is a minimal example, it takes a while to occur, but in my project it occurs frequently
+1
@AntonioErdeljac
The error occurs when I try get the data from the new pages GetAllProducts(page=1, size=10). Before it, the RQ works well.
I tried downgrading the RQ version. But it didn't work. I used fetch data to put it in a Shadcn table. I guess RQ and Shadcn aren't a good match. I don't know why yet, but the error is in the Shadcn table
The logger said that the error occurs in this line:
{table.getRowModel().rows?.length ? (
if i find out something I back here.
@Merus23 What you're seeing is probably an unrelated error. Look into how your table component's parent is rendered, how table is getting data and whether the data is referentially stable.
I am experiencing this error with RQ version 5.66.9 and tRPC 11 after throwing error in TRPC procedure ( given that the procedure is being prefetched in server component ) I am following the basic setup described here: https://trpc.io/docs/client/tanstack-react-query/server-components#leveraging-suspense
I don't know much about under the hood, but I get this seemingly if I have a prefetched query that never gets consumed.
In the below example, it works totally fine, however if I comment out <PokemonInfo /> then I start getting the exceeded error.
export default function Home() {
const queryClient = getQueryClient();
void queryClient.prefetchQuery(pokemonOptions);
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<PokemonInfo />
</HydrationBoundary>
);
}
I have a fix up in #9157, if you want to help verify it works for you, you can install the prerelease packages with:
npm i https://pkg.pr.new/@tanstack/query-core@1568117
npm i https://pkg.pr.new/@tanstack/react-query@1568117
(You can verify those are the packages from the PR and find any new ones in case the PR updates by going to the Checks and clicking pkg.pr.new)
I thought my PR would solve this, and I'm pretty sure it solves some versions of it, but I've seen this pop up again even after the PR, so reopening to investigate.