Skip to content

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

Closed

Description

@albertogasparin

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

Activity

  1. dai-shi commented on Nov 23, 2019

    @dai-shi
    Contributor

    👍 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.

  2. dai-shi commented on Jan 11, 2020

    @dai-shi
    Contributor

    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.

  3. acdlite commented on Feb 21, 2020

    @acdlite
    Collaborator

    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.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions