facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
228.98k stars 46.85k forks source link

[React 19] Upgrading React causes infinite refetching #30799

Open cometkim opened 2 months ago

cometkim commented 2 months ago

Summary

The reproduction is using Relay, but I came as this seems closer to a bug in React than Relay.

https://stackblitz.com/@cometkim/collections/react-relay-suspend-loop

With this basic setup, using useLazyLoadQuery with network-only to make a new fetch() call on render. The code works fine in v18, but after upgrading to v19, it starts remounting an element infinitely.

The expected behavior is that the <Suspense> boundary is retained stable, and the <NetworkOnly> is rendered after waiting for the QueryResource fulfilled.

However, this seems to me like the <Suspense> could suspend itself.

Kanishk-tiwari-045 commented 2 months ago

So for starters, I would just like to ask, what exactly you are looking to resolve this? Like for say, we can stay on the v18. Is upgradation so much important ?

nkalpakis21 commented 2 months ago

built an app to get paid for this PR https://www.n0va-io.com/discover/facebook/react