Skip to content

[React 19] use is significantly slower in some scenarios than throwing a Promise #29855

Open
@phryneas

Description

@phryneas

Summary

This is something I noticed when I applied the Apollo Client test suite to React 19 - we had one test that was timing out.

I first thought that the test was broken, but it turns out it was just really slow.

Cranking the test that finished in React 18 in under 200 milliseconds to a timeout of 10 seconds for React 19 made it pass (6 seconds would still consistently fail, 7 seconds started to pass on localhost).

Further I noticed that if we use our __use polyfill that throws a Promise instead of use, the test finishes in under 500 milliseconds - still slower than React 18, but significantly faster than React 19 with native use.

This is the test in question:

https://github.com/apollographql/apollo-client/blob/8e3edd4f5e5191453ba3ca1a1cc4fc4a02b936e8/src/react/hooks/__tests__/useSuspenseQuery.test.tsx#L9519-L9615

I'd be happy to work with you on further identifying the root cause for this, but I'll be moving houses in a few days, and I just don't have the time to create an isolated reproduction for this within the next 1-2 weeks, I'm really sorry.

Still, I assume this might be important for you, so I'll at least open a ticket to let you know :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions