Repository navigation
[composite] Fix list map tick canceling in StrictMode - #5862
Merged
Merged
Conversation
atomiks
marked this pull request as ready for review
October 2, 2026 04:05
atomiks
requested review from
colmtuite,
flaviendelangle,
jjenzz and
michaldudak
as code owners
October 2, 2026 04:05
commit: |
Bundle size
PerformanceTotal duration: 674.49 ms +1.96 ms(+0.3%) | Renders: 76 (+0) | Paint: 1,204.86 ms +10.61 ms(+0.9%) No significant changes — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
atomiks
force-pushed
the
claude/priceless-cartwright-1ed2bd
branch
from
October 5, 2026 02:54
be4de4e to
9741af8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CompositeListforces a map rebuild by toggling a boolean state (setMapTick((tick) => !tick)). Under React 19 Strict Mode, two toggles can land in the same render and cancel out. That happens when the list re-renders in the same commit that mounts new items: the flush effect clearsisDirtyRefwhile the first toggle is still queued, then Strict Mode replays the new items' refs and queues a second toggle. React sees no state change and skips the render, so the flush never runs andisDirtyRefstaystrue. Every laterregister/unregisterthen bails out early, andelementsRefstops syncing, so items that later mount or unmount without the list re-rendering drop out of keyboard navigation.This PR uses an incrementing counter instead, so queued updates can't cancel each other. This only affects Strict Mode (dev) builds. The regression test replaces the list's items under Strict Mode, then hides one item without re-rendering the list.