Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React 19] Upgrading React causes infinite refetching #30799

Open
cometkim opened this issue Aug 23, 2024 · 2 comments
Open

[React 19] Upgrading React causes infinite refetching #30799

cometkim opened this issue Aug 23, 2024 · 2 comments
Labels

Comments

@cometkim
Copy link

cometkim commented Aug 23, 2024

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.

  • React v18: No issues
  • React v19: No differences, but the children including the suspense boundary is unexpectedly unmounted, resulting in an infinite refetch loop.
  • React v19 workaround 1: Removing <StrictMode> seems to solve the issue.
  • React v19 workaround 2: Wrap the parent (which is just a context provider with nothing special) by one more <Suspense> boundary. It seems to do not make sense, but it works.

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants