Describe the bug#
When using @tanstack/react-query with the Next.js App Router in development (reactStrictMode: true), navigating to a page with an active useQuery results in a 'signal is aborted without reason' error.
Here's a very minimal repo reproducing this issue:
https://github.com/mrmps/react-query-error
It occurs for Next.js 13, 15, and 16.
Things I tried to fix:
- remove Link prefetch
- remove react-strict-mode (seems to slightly help, but the error is reproduced if you navigate quickly between pages.
If this is expected behavior, what's the recommended way to handle this?
Your minimal, reproducible example#
https://github.com/mrmps/react-query-error
Steps to reproduce#
- Clone repo
- pnpm install
- click the link to the problem page.
Expected behavior#
I expect to not see this overlay:
Instead it shows up every time. There's no issue with actual page behavior.
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
Tanstack Query adapter#
react-query
TanStack Query version#
v^5.62.7
TypeScript version#
"typescript": "^5"
Additional context#
No response
I tried out the reproduction locally and I’m not getting a nextJs overlay. Only the code where you
console.errorexplicitly in thequeryFntriggers it, which I guess is how nextJs works 🤷♂️