Skip to content

experimental_promise: A component was suspended by an uncached promise #8384

Description

@TkDodo

Describe the bug

using the new experimental promise with use in React 19 leads to an error when multiple queries are used in the same transition. The error is:

A component was suspended by an uncached promise. Creating promises inside a Client Component or hook is not yet supported, except via a Suspense-compatible library or framework. 
    at Example2 (https://7g9lfw.csb.app/src/App.js:51:5)
    at Suspense
    at div
    at SuspenseBoundary (https://7g9lfw.csb.app/src/App.js:73:49)
    at QueryClientProvider (https://7g9lfw.csb.app/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.cjs:55:3)
    at div
    at Example

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/suspense-transitions-7g9lfw

Steps to reproduce

  • click decrease
  • look at the error in the devtools
  • you can also see that 2.1 shows the right value, while 2.2 shows the wrong (outdated) value

everything works fine if we remove startTransition

Expected behavior

Both components (2.1 and 2.2) should show the correct state values

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

React 19RC, ReactQuery 5.62.0

Tanstack Query adapter

react-query

TanStack Query version

5.62.0

TypeScript version

Additional context

Initially, I wanted to test if placeholderData: keepPreviousData works inside transitions. And it does - but I found those weird errors, and noticed they have nothing to do with placeholderData, but rather always happen if use the same transition value in multiple queries. It doesn’t matter if they are in the same suspense boundary or not.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions