Skip to content
Source
Sign inSign up
TanStack/query

v5: docs about environments without AbortController does not match actual behavior #5837

Send to my agent
ClosedCoolSpring8(GitHub profile, opens in a new tab) opened this issue 1 comment

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

  1. (The sandbox uses "delete window.AbortController" to simulate browsers without AbortController API)
  2. Open console
  3. 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

  1. 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 AbortController polyfill.

  2. TkDodo added labelsdocumentation

  3. TkDodo added labelsv5

  4. TkDodo closed this

Sign in to join this conversation.