Skip to content

Conversation

@boschni
Copy link
Collaborator

@boschni boschni commented Feb 10, 2021

This PR adds support for concurrent mode rendering.

Render functions will now only have these side effects:

  • Creating a cache entry (should be allowed)
  • Dispatching a GET request (should be allowed)

When calling a render function, it will return an optimistic result, without actually changing the observer state. The observer state will only be changed when new options are set/committed in an effect.

Unfortunately I was not able to keep the referential integrity of the result object between renders because we do not know which optimistic result will eventually get committed.

Fixes #1536

@vercel
Copy link

vercel bot commented Feb 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/4un12itz7
✅ Preview: https://react-query-git-feature-concurrent-mode.tannerlinsley.vercel.app

@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@klarstrup
Copy link
Contributor

I don't have a minimal repro at present, but I believe this change has broken useInfiniteQuery SSR in my app. Worked on 3.8.3, simply renders with data: undefined on 3.9.0.

@boschni
Copy link
Collaborator Author

boschni commented Feb 13, 2021

Could you provide some more information? Does it only apply to infinite queries? What options are you using? Is your usage similar to https://github.com/tannerlinsley/react-query/tree/master/examples/nextjs ?

@klarstrup
Copy link
Contributor

My specific setup is using react-ssr-prepass but that example is similar enough I believe. I'm working on a minimal repro.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v3] Concurrent mode broken

4 participants