Skip to content

Bug: A queued no-op useState update can roll back a guarded render-phase update. #38408

Backlog

Description

@RoBackman

On React 19.3.1, a queued useState updater that returns the current value can cause a later render-phase update to be lost. In the reproduction, a prop change triggers two guarded setters during render: one records that the response was processed, and the other displays a validation message. Both updates appear in the first commit. In the next commit, the message reverts to empty while the processed marker stays updated, so the guard never restores the message.

React version: 19.3.1

Steps To Reproduce

In the CodeSandbox reproduction:

  1. Click Queue no-op. This calls setMessage(current => current).
  2. Click Submit in a transition and inspect the commit log.
  3. Reload the preview and repeat with Submit from a timer.

To run the control, reload again, queue the no-op, and click Submit directly.

Link to code example: https://codesandbox.io/p/sandbox/l44nch

The current behavior

For both the transition and timer cases, the commit log first shows response=1, seen=1, message="Required". The next commit shows response=1, seen=1, message="". Because seen already matches response, the render guard never restores the message. In the direct-click control, the message stays "Required".

The expected behavior

After the response changes, both guarded render-phase updates should persist. The processed marker should remain 1 and the message should remain "Required". The earlier no-op should leave the message unchanged.

Activity

  1. added
    Status: Unconfirmed
    on Nov 27, 2026
  2. mserhatyuksel commented on Nov 27, 2026

    @mserhatyuksel

    I reproduced this on React 19.3.1 and am comparing a couple of fixes for how render-phase updates are handled when the hook queue is replayed. I’ll follow up once I’ve tested them.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Unconfirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions