You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: A queued no-op useState update can roll back a guarded render-phase update. #38408
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:
Click Queue no-op. This calls setMessage(current => current).
Click Submit in a transition and inspect the commit log.
Reload the preview and repeat with Submit from a timer.
To run the control, reload again, queue the no-op, and click Submit directly.
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.
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.
Activity
mserhatyuksel commentedon Nov 27, 2026
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.