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

[Concurrent mode] Scheduled updates are lost when parent state update happens #17028

Closed
albertogasparin opened this issue Oct 7, 2019 · 3 comments

Comments

@albertogasparin
Copy link

Do you want to request a feature or report a bug?
Probably a bug

What is the current behavior?
When in concurrent mode (render with unstable_createRoot), triggering a state change via an event (eg click) on the parent makes React loose the scheduled updates in the children. See:

https://codesandbox.io/s/react-concurrent-state-bug-sp6zq

Not an expert on concurrent mode here, was just playing around with it. Noticed that when some interactions happen the work (probably moved to the other tree) gets lost if the parent re-renders. You can see by clicking anywhere in the sandbox page vs clicking on the button that changes some local state. But that is just my educated guess on what might be happening.

What is the expected behavior?

State updates that are scheduled in children components should happen and the DOM value should reflect the state.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

react: 16.10.2
react-dom: 16.10.2

@dai-shi
Copy link
Contributor

dai-shi commented Nov 23, 2019

👍 Linking my comment #16396 (comment). I thought it was an issue with use-subscription back then, but it turns out to be a broader issue.

@dai-shi
Copy link
Contributor

dai-shi commented Jan 11, 2020

Hey, you might want to try with the latest experimental channel.
In my tool, 0.0.0-experimental-f42431abe fixes some cases. But not all.

@acdlite
Copy link
Collaborator

acdlite commented Feb 21, 2020

Thanks for the bug report!

I believe this was fixed by #18091

You can confirm using react@0.0.0-experimental-ea6ed3dbb and react-dom@0.0.0-experimental-ea6ed3dbb.

I'm going to close this issue, but if the bug persists please comment and we'll reopen.

@acdlite acdlite closed this as completed Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants