Repository navigation
[lexical-list] Bug Fix: DOMImportExtension list normalization uses ListNode.createListItemNode() - #9002
Closed
LeSingh1 wants to merge 1 commit into
Closed
[lexical-list] Bug Fix: DOMImportExtension list normalization uses ListNode.createListItemNode()#9002LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
…stNode.createListItemNode() ## Description `ListNode.createListItemNode()` was added in meta#8427 ("Add the `createListItemNode` method to the ListNode and use it for children normalization") precisely so a `ListNode` subclass controls the item type its normalization synthesizes. The legacy converter honours it — `$normalizeChildren` does `listNode.createListItemNode.bind(listNode)` — and so does `ListNode.splice`. The `DOMImportExtension` port of that normalization, `$normalizeListChildren` in `ListImportExtension`, does not: it calls the module-level `$createListItemNode()` instead, so a subclassed list imported through the new pipeline gets plain `ListItemNode` wrappers for both of its synthesized-item cases (a nested list lifted into a sibling item, and a non-item child wrapped into one). The two implementations of the same normalization disagree. This threads the `ListNode` being built into `$normalizeListChildren` and uses `listNode.createListItemNode()`, matching `$normalizeChildren`. The default `ListNode.createListItemNode()` returns `$createListItemNode()`, so nothing changes for unsubclassed lists. ## Test plan `npx vitest run packages/lexical-list/src/__tests__/unit/ListImportExtension.test.ts` ### Before ``` FAIL |unit| packages/lexical-list/src/__tests__/unit/ListImportExtension.test.ts > ListImportExtension > wrapper items come from ListNode.createListItemNode() AssertionError: expected 'listitem' to be 'custom-listitem' // Object.is equality Expected: "custom-listitem" Received: "listitem" Test Files 1 failed (1) Tests 1 failed | 11 passed (12) ``` ### After ``` Test Files 1 passed (1) Tests 12 passed (12) ``` `npx vitest run packages/lexical-list` is green (10 files, 126 tests).
LeSingh1
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
August 9, 2026 05:04
|
@LeSingh1 is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
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
ListNode.createListItemNode()was added in #8427 ("Add thecreateListItemNodemethod to the ListNode and use it for childrennormalization") precisely so a
ListNodesubclass controls the item type itsnormalization synthesizes. The legacy converter honours it —
$normalizeChildrendoeslistNode.createListItemNode.bind(listNode)— andso does
ListNode.splice.The
DOMImportExtensionport of that normalization,$normalizeListChildreninListImportExtension, does not: it calls themodule-level
$createListItemNode()instead, so a subclassed list importedthrough the new pipeline gets plain
ListItemNodewrappers for both of itssynthesized-item cases (a nested list lifted into a sibling item, and a
non-item child wrapped into one). The two implementations of the same
normalization disagree.
This threads the
ListNodebeing built into$normalizeListChildrenanduses
listNode.createListItemNode(), matching$normalizeChildren. Thedefault
ListNode.createListItemNode()returns$createListItemNode(), sonothing changes for unsubclassed lists.
Test plan
npx vitest run packages/lexical-list/src/__tests__/unit/ListImportExtension.test.tsBefore
After
npx vitest run packages/lexical-listis green (10 files, 126 tests).