Describe the bug#
Hello,
While working on a WeChat mini program and using the latest v5 beta (v5.0.0-beta.14) of @tanstack/react-query, I encountered an error: ReferenceError: AbortController is not defined. Although it is true that the WeChat mini program lacks support for AbortController (and probably does not fall under the category of "modern browsers" as required by v5 -- description of the runtime), this behavior does not align with the current documentation.
According to the latest documentation available at https://tanstack.com/query/v5/docs/react/guides/query-cancellation, it states that "The AbortController API is available in most runtime environments. However, if the runtime environment does not support it, the query function will receive undefined in its place."
However, the recent commit https://github.com/TanStack/query/commit/b3f3c59e0f5a90337af0ca3933f87b5a375fceb7 introduced a change to drop support for browsers without the API.
Since v5 targets modern browsers, I guess this change is not considered a regression. Therefore, I suggest removing that statement from the documentation to avoid confusion for users in unsupported environments. Polyfills would be needed in these environments.
Thank you for your attention to this matter.
Your minimal, reproducible example#
https://codesandbox.io/p/sandbox/epic-pike-pknnjh
Steps to reproduce#
- (The sandbox uses "delete window.AbortController" to simulate browsers without AbortController API)
- Open console
- See error
Uncaught ReferenceError: AbortController is not defined
Expected behavior#
Expected the page to function normally
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
- OS: macOS
- Browser: Weixin DevTools
- Version: 1.06.2307250 (NW.js 0.54.1)
Tanstack Query adapter#
react-query
TanStack Query version#
v5.0.0-beta.14
TypeScript version#
No response
Additional context#
No response
thanks for reporting. I updated the requirements here:
but I forgot about the page about query cancellation. Would you like to PR a docs update?
Yes, with v5, you need to provide your own
AbortControllerpolyfill.