[lexical] Bug Fix: Skip $reconcileChildren fast path during full reconcile#8564
Merged
Conversation
…ncile (facebook#8563) The sizeDelta===0 children fast path walks from prevElement.__first while following the next node map's __next pointers, assuming prev and next children share the same keys in the same order. It gated that assumption on _cloneNotNeeded, but a FULL_RECONCILE (setEditorState, which backs history undo/redo) swaps the node map wholesale without routing changes through getWritable(), leaving _cloneNotNeeded empty even when children differ by key. Undoing a markdown code-block transform produces a same-size child key swap, so the walk reached a next-only key and threw "reconcileNode: prevNode or nextNode does not exist in nodeMap" during reconciliation. Gate the fast path on !treatAllNodesAsDirty so full reconciles fall through to the general key-diffing path. https://claude.ai/code/session_01EAeZ6geVH74SpUrRhY6Z8h
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Manage the editor lifecycle with `using` and move root-element setup/teardown into a test extension's register function (setRootElement + document.body cleanup), matching the idiom used by the other reconciler repro tests. The editor's dispose also calls setRootElement(null), so the whole fixture tears down at end of scope without an afterEach. https://claude.ai/code/session_01EAeZ6geVH74SpUrRhY6Z8h
…#8563 repro A detached root element is enough to drive DOM reconciliation for this repro (the crash is in node-map lookups, not layout), so set it inline and let the `using` editor's dispose call setRootElement(null). Removes the test extension and document.body bookkeeping. https://claude.ai/code/session_01EAeZ6geVH74SpUrRhY6Z8h
zurfyx
approved these changes
May 26, 2026
This was referenced May 26, 2026
Merged
Merged
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.
Description
The sizeDelta===0 children fast path walks from prevElement.__first while following the next node map's __next pointers, assuming prev and next children share the same keys in the same order. It gated that assumption on _cloneNotNeeded, but a FULL_RECONCILE (setEditorState, which backs history undo/redo) swaps the node map wholesale without routing changes through getWritable(), leaving _cloneNotNeeded empty even when children differ by key. Undoing a markdown code-block transform produces a same-size child key swap, so the walk reached a next-only key and threw "reconcileNode: prevNode or nextNode does not exist in nodeMap" during reconciliation.
Gate the fast path on !treatAllNodesAsDirty so full reconciles fall through to the general key-diffing path.
Closes #8563
Test plan
New unit tests