Description
Describe the bug
Hello,
I have implemented cancelation in my project, but it does not seem to work when working with Suspense
and useSuspenseQuery
/ useSuspenseQueries
hooks.
I have tested with useQuery
and it works perfectly.
I don't see any mention in the documentation that the cancelation does not work with suspense, and don't see at first sight any reason it would be impossible to cancel queries when working with Suspense.
Thanks for the library which is really cool :)
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-5dtu8c?file=src%2FApp.tsx
Steps to reproduce
- Click on the increment button that will simulate multiple call to get the person information for the
id: count
- See in the console that there is no log concerning the cancelation of the request
ps: it's also possible to simulate the unmounting of the component while a request is running (it does not cancelled the request too)
Expected behavior
I expect that running queries are cancelled
How often does this bug happen?
Every time
Screenshots or Videos
Cancelation working with useQuery
:
Enregistrement.de.l.ecran.2024-08-12.a.14.33.11.mov
Cancelation not working with useSuspenseQuery
:
Enregistrement.de.l.ecran.2024-08-12.a.14.32.25.mov
Platform
- OS: Mac OS 14.6.1
- Browser: Chrome 127.0.6533.100
Tanstack Query adapter
react-query
TanStack Query version
5.51.23
TypeScript version
5.5.4
Additional context
No response