Skip to content

Fix false "Maximum update depth exceeded" across unrelated updates - #38429

Open
phibr0 wants to merge 1 commit into
react:mainfrom
phibr0:fix-nested-update-skipped-lanes
Open

phibr0 wants to merge 1 commit into
react:mainfrom
phibr0:fix-nested-update-skipped-lanes

Conversation

@phibr0

@phibr0 phibr0 commented Nov 28, 2026

Copy link
Copy Markdown

Summary

Fixes #38428.

React throws "Maximum update depth exceeded" when many unrelated updates arrive in separate tasks and each commit leaves some DefaultLane work pending. The nested update counter only resets after a commit that leaves nothing pending, so those commits add up as if they were one cascade.

  • An update scheduled outside the render and commit phases now resets the counter. It came from an event, a timer or a store, not from the previous commit.
  • Strict Mode's second effect invocation now always runs in the commit context, so its updates still count as nested.

How did you test this change?

  • Added two tests that fail on main, and two for loops that must still throw.
  • yarn test, yarn test --prod, yarn test-stable and yarn test-www (both variants) pass. ESLint, Prettier and yarn flow dom-node pass.
  • Verified against the app where we hit this.

Copilot AI balanced review requested due to automatic review settings November 28, 2026 21:51
@meta-cla meta-cla Bot added the CLA Signed label Nov 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown

A size report will appear here when the build finishes.

Generated by sizebot against 606778a

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: "Maximum update depth exceeded" when unrelated updates arrive in separate tasks

2 participants