Repository navigation
[lexical] Bug Fix: preserve custom element text in root cache - #9260
Merged
Merged
Conversation
## Description A custom element that returns `~"Hello"` from `getTextContent()` currently produces `Hello` from `$getRoot().getTextContent()` after DOM reconciliation. Reads during an update honor the override, but the reconciled root cache and text-content listeners lose it. Honor non-root element overrides when creating and refreshing the reconciliation text cache. Ordinary elements keep the existing incremental path. Custom parents bypass suffix text splicing because their text need not be a concatenation of child text. When a subtree moves, compute its previous semantic text length so custom descendants cannot corrupt the source parent's remaining text. Adds regression coverage for empty/non-empty custom elements, descendant-only edits, clean siblings, child suffix changes, editor-state replacement, moved ancestors and named slots. No public API or dependency changes. Closes meta#5336. Thanks to tecoad for the report. Implemented and validated with Codex assistance. ## Test plan ### Before With unchanged production source at `8f9fec8961787aa7378b6c4f132ea491002b48ae` and the new tests: ```sh ./node_modules/.bin/vitest --project unit --run packages/lexical/src/__tests__/unit/LexicalCustomTextContent.test.ts ``` ```text Test Files 1 failed (1) Tests 8 failed (8) ``` ### After The same command with the fix: ```text Test Files 1 passed (1) Tests 8 passed (8) ``` The affected core, list, table, clipboard and HTML unit suites also pass: ```sh ./node_modules/.bin/vitest run --project unit \ packages/lexical/src/__tests__/unit \ packages/lexical-list/src/__tests__/unit \ packages/lexical-table/src/__tests__/unit \ packages/lexical-clipboard/src/__tests__/unit \ packages/lexical-html/src/__tests__/unit ``` ```text Test Files 125 passed (125) Tests 2019 passed (2019) ``` Type checking (`tsc --project tsconfig.test.json --noEmit`), changed-file ESLint and Prettier, and `git diff --check` pass. As a targeted guard check, reverting only the moved-element length correction makes the moved-ancestor regression fail: the source parent's final `Third` becomes `ThiThird`. Restoring the correction passes. Local validation used macOS arm64 and jsdom. Native browser and Windows/Linux runs were not performed for this semantic cache change.
maximilliangrand
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7,
potatowagon and
zurfyx
as code owners
September 28, 2026 16:46
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Sep 28, 2026
| // tree. (`__parent === null` means detached/removed, not moved — its | ||
| // DOM cache is still its prev text.) | ||
| size += prevNode.getTextContentSize(); | ||
| size += prevNode.getTextContent().length; |
Collaborator
There was a problem hiding this comment.
It doesn't make sense for getTextContentSize not to return the same number as getTextContent().length. At best, this is just hiding other problems.
## Description Give the custom test paragraph a matching getTextContentSize() implementation and assert size/text consistency for custom nodes, ordinary ancestors and slots. Restore the original moved-element size calculation: the root-cache fix should work with a valid custom node instead of tolerating inconsistent text methods. Addresses the review on meta#9260. No public API changes. ## Test plan ### Before With unchanged production source at 8f9fec8 and the revised, contract-compliant regression tests: ./node_modules/.bin/vitest --project unit --run packages/lexical/src/__tests__/unit/LexicalCustomTextContent.test.ts Test Files 1 failed (1) Tests 8 failed (8) ### After The same command with the root-cache fix: Test Files 1 passed (1) Tests 8 passed (8) ./node_modules/.bin/vitest run --project unit packages/lexical/src/__tests__/unit packages/lexical-list/src/__tests__/unit packages/lexical-table/src/__tests__/unit packages/lexical-clipboard/src/__tests__/unit packages/lexical-html/src/__tests__/unit Test Files 125 passed (125) Tests 2019 passed (2019) TypeScript test-project check, changed-file ESLint and Prettier, and git diff --check passed. Local validation used macOS arm64 and jsdom; native browser and Windows/Linux runs were not performed for this revision. Codex-assisted.
rinarakaki
added a commit
to rinarakaki/lexical
that referenced
this pull request
Sep 30, 2026
…in a decorator's named slot ## Description A decorator slot host's text includes its slots' text. An edit inside a slot marks the host dirty through `__slotHost` but doesn't clone it, so the text size the reconciler caches on the host instance (`CACHED_TEXT_SIZE_KEY`) is never rewritten, and is stale after the first slot edit. When the host is in the dirty suffix of a parent with four or more children, the children fast path splices the parent's cached text by the suffix's previous size, which `$prevSuffixTextSize` reads from that cache, so it cuts too little. From the second edit on, `$getRoot().getTextContent()` and text-content listeners get part of the old slot text: `ab\ncd CCDE` where the tree reads `ab\ncd CDE`. `$prevSuffixTextSize` now measures a leaf that hosts slots with `getTextContentSize()`, inside the walk's existing read of the previous state, instead of reading its cached size. Both fast paths go through it: the same-size suffix splice and `$tryReconcileSuffixWithSizeDelta`. The comments that said every leaf's cached size is valid now name the exception. The cost is measuring a slot host's slot text, only when it is in a spliced suffix. meta#9260 changes the same cache for elements that override `getTextContent`; it doesn't touch this path. Closes meta#9277 ## Test plan New unit tests in `LexicalSlot.test.ts`, "named-slots: root text after repeated slot edits", check `$getRoot().getTextContent()` after every edit: a decorator host that ends a paragraph of four children, one that is the last of four blocks, and a text appended or removed after an edited host (the size-delta path, +1 and -1). Two controls pass before and after: three children, where the fast path doesn't engage, and an inline element host, which is sized from its DOM cache. ### Before ``` $ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical/src/__tests__/unit/LexicalSlot.test.ts -t "root text after repeated slot edits" × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of four children × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a block decorator host that is the last of four blocks × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text appended after an edited decorator host × |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text removed after an edited decorator host ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of three children ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline element host that ends a paragraph of four children AssertionError: expected 'ab\ncd CCDE' to be 'ab\ncd CDE' // Object.is equality AssertionError: expected 'a\n\nb\n\nc\n\nCCDE' to be 'a\n\nb\n\nc\n\nCDE' // Object.is equality AssertionError: expected 'ab\ncd CCD ef' to be 'ab\ncd CD ef' // Object.is equality AssertionError: expected 'ab\ncd CCD' to be 'ab\ncd CD' // Object.is equality Test Files 1 failed (1) Tests 4 failed | 2 passed | 118 skipped (124) ``` ### After ``` $ pnpm exec vitest --project unit --no-watch --reporter=verbose packages/lexical/src/__tests__/unit/LexicalSlot.test.ts -t "root text after repeated slot edits" ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of four children ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a block decorator host that is the last of four blocks ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text appended after an edited decorator host ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > a text removed after an edited decorator host ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline decorator host that ends a paragraph of three children ✓ |unit| packages/lexical/src/__tests__/unit/LexicalSlot.test.ts > named-slots: root text after repeated slot edits > an inline element host that ends a paragraph of four children Test Files 1 passed (1) Tests 6 passed | 118 skipped (124) ``` The full unit run (`pnpm run test-unit`) passes except for three tests: ``` FAIL |unit| packages/lexical/src/__tests__/unit/FastPathCrossParent.test.ts > fast path differential fuzz — cross-parent moves > fast path matches the general walk across cross-parent moves FAIL |unit| packages/lexical-markdown/src/__tests__/unit/LexicalMarkdown.test.ts > link destination whitespace does not backtrack > reads a run of tabs FAIL |scripts-unit| scripts/__tests__/unit/typedocExternalLinks.test.ts > links external types and sources with a pnpm install Test Files 3 failed | 366 passed (369) Tests 3 failed | 9014 passed | 1 skipped (9018) ``` The first two timed out at 5 s under load, and pass when run alone (`FastPathCrossParent.test.ts` and `LexicalMarkdown.test.ts`: 591 passed). `typedocExternalLinks.test.ts` failed only because that run passed a relative `TMPDIR`; with an absolute one it passes (2 passed). `pnpm run tsc`, `pnpm run tsc-test`, prettier and eslint pass on the changed files. No public API changes, so Flow isn't affected; no browser tests were needed, since the change is in the reconciler's text cache. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
etrepum
reviewed
Sep 30, 2026
etrepum
left a comment
Collaborator
There was a problem hiding this comment.
We should have similar code in getTextContentSize to detect the override of getTextContent and a test to cover it
etrepum
approved these changes
Oct 1, 2026
zurfyx
added a commit
that referenced
this pull request
Oct 15, 2026
## Description The changes merged since v0.52.0 predate changesets, so without entries the v0.53.0 section would leave them out, including the breaking removal of the deprecated import extensions (#9316). This adds a changeset for every user-facing pull request in v0.52.0..main, written from each pull request, with a `PR: #N` line (they land in this pull request rather than the original ones) and the original author's handle: - breaking: #9316, with the full replacement table as `Migration:` - feature: #9312 - fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319, #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302, #9261, #9262, #9263, #9258 - perf: #9264 Skipped as not user-facing: dependency bumps (all devDependencies), website and docs updates, test and CI changes, the private devtools extension and eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to `any` change). It also adds a `[chore]` changeset for this pull request itself, which adds CHANGELOG.md to the `lexical` package's `files`. ## Test plan ### Before ``` $ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn # at the previous commit warning: This pull request changes published code without a changeset for: lexical: packages/lexical/package.json (files) ... Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only. ``` ### After ``` $ node scripts/changesets/check.mjs --base origin/main Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset. ``` The `latest` release step in a throwaway clone of this branch, with the real tags: ``` $ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30 Added v0.53.0 to CHANGELOG.md from 27 changeset(s). $ ls .changeset changelog.cjs config.json README.md $ sed -n 1,9p CHANGELOG.md ## v0.53.0 (2026-10-30) ### Breaking changes - **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316)) The deprecated import and alias extensions are removed. The `*ImportRules` arrays, including `HorizontalRuleImportRules`, stay. $ grep -n '^### ' CHANGELOG.md | head -7 3:### Breaking changes 28:### Features 36:### Fixes 98:### Performance 102:### Other 106:### Contributors 110:### All changes $ sed -n '/^### Contributors/,+2p' CHANGELOG.md ### Contributors @Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira $ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2 - [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou - [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry ``` (`### All changes` has 50 lines: the 48 commits after v0.52.0, without the `v0.52.0 (#9252)` bump commit, plus this branch's two commits.) Running again before that release PR is merged: ``` $ git tag v0.53.0 # tagged, but CHANGELOG.md on main has no v0.53.0 section $ npm_package_version=0.54.0 node scripts/changesets/release.mjs CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases. (exit 1) $ npm_package_version=0.53.1 node scripts/changesets/release.mjs Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release: - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier Run the release with the "minor" increment instead. (exit 1) ``` A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built, so the export check that follows fails as expected): ``` $ node scripts/npm/prepare-release.mjs [lexical] CHANGELOG.md lists pending changes as Unreleased [lexical] package.json references files that are not present in packages/lexical: ./dist/Lexical.dev.js $ sed -n 1,5p packages/lexical/CHANGELOG.md ## Unreleased Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut. ### Breaking changes $ git status --short CHANGELOG.md (clean: only the gitignored package copy changed) ```
zurfyx
added a commit
that referenced
this pull request
Oct 15, 2026
## Description The changes merged since v0.52.0 predate changesets, so without entries the v0.53.0 section would leave them out, including the breaking removal of the deprecated import extensions (#9316). This adds a changeset for every user-facing pull request in v0.52.0..main, written from each pull request, with a `PR: #N` line (they land in this pull request rather than the original ones) and the original author's handle: - breaking: #9316, with the full replacement table as `Migration:` - feature: #9312 - fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319, #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302, #9261, #9262, #9263, #9258 - perf: #9264 Skipped as not user-facing: dependency bumps (all devDependencies), website and docs updates, test and CI changes, the private devtools extension and eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to `any` change). Four fixes change observable output or behavior, so their changesets have a `Verify:` paragraph and are listed under Behavior changes: #9303 (new tabs get no `window.opener`), #9272 (imported code content is normalized), #9261 (`$patchStyleText` styles the selection it is given), #9319 (editor keys and namespaces are a counter without a DOM). It also adds a `[chore]` changeset for this pull request itself, which adds CHANGELOG.md to the `lexical` package's `files`. ## Test plan ### Before ``` $ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn # at the previous commit warning: This pull request changes published code without a changeset for: lexical: packages/lexical/package.json (files) ... Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only. ``` ### After ``` $ node scripts/changesets/check.mjs --base origin/main Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset. ``` The `latest` release step in a throwaway clone of this branch, with the real tags: ``` $ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30 Added v0.53.0 to CHANGELOG.md from 27 changeset(s). $ ls .changeset changelog.cjs config.json README.md $ sed -n 1,9p CHANGELOG.md ## v0.53.0 (2026-10-30) ### Breaking changes - **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316)) The deprecated import and alias extensions are removed. The `*ImportRules` arrays, including `HorizontalRuleImportRules`, stay. $ grep -n '^### ' CHANGELOG.md | head -8 3:### Breaking changes 28:### Behavior changes 54:### Features 62:### Fixes 108:### Performance 112:### Other 116:### Contributors 120:### All changes $ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md ### Behavior changes - **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303)) This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged. Verify: pages opened from editor links that relied on `window.opener`. $ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json # (kind, [(pr, behavior)]) [('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])] $ sed -n '/^### Contributors/,+2p' CHANGELOG.md ### Contributors @Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira $ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2 - [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou - [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry ``` (`### All changes` has 50 lines: the 48 commits after v0.52.0, without the `v0.52.0 (#9252)` bump commit, plus this branch's two commits.) Running again before that release PR is merged: ``` $ git tag v0.53.0 # tagged, but CHANGELOG.md on main has no v0.53.0 section $ npm_package_version=0.54.0 node scripts/changesets/release.mjs CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases. (exit 1) $ npm_package_version=0.53.1 node scripts/changesets/release.mjs Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release: - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier Run the release with the "minor" increment instead. (exit 1) ``` A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built, so the export check that follows fails as expected): ``` $ node scripts/npm/prepare-release.mjs [lexical] CHANGELOG.md lists pending changes as Unreleased [lexical] package.json references files that are not present in packages/lexical: ./dist/Lexical.dev.js $ sed -n 1,5p packages/lexical/CHANGELOG.md ## Unreleased Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut. ### Breaking changes $ git status --short CHANGELOG.md (clean: only the gitignored package copy changed) ```
zurfyx
added a commit
that referenced
this pull request
Oct 15, 2026
## Description The changes merged since v0.52.0 predate changesets, so without entries the v0.53.0 section would leave them out, including the breaking removal of the deprecated import extensions (#9316). This adds a changeset for every user-facing pull request in v0.52.0..main, written from each pull request, with a `PR: #N` line (they land in this pull request rather than the original ones) and the original author's handle: - breaking: #9316, with the full replacement table as `Migration:` - feature: #9312 - fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319, #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302, #9261, #9262, #9263, #9258 - perf: #9264 Skipped as not user-facing: dependency bumps (all devDependencies), website and docs updates, test and CI changes, the private devtools extension and eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to `any` change). Four fixes change observable output or behavior, so their changesets have a `Verify:` paragraph and are listed under Behavior changes: #9303 (new tabs get no `window.opener`), #9272 (imported code content is normalized), #9261 (`$patchStyleText` styles the selection it is given), #9319 (editor keys and namespaces are a counter without a DOM). It also adds a `[chore]` changeset for this pull request itself, which adds CHANGELOG.md to the `lexical` package's `files`. ## Test plan ### Before ``` $ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn # at the previous commit warning: This pull request changes published code without a changeset for: lexical: packages/lexical/package.json (files) ... Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only. ``` ### After ``` $ node scripts/changesets/check.mjs --base origin/main Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset. ``` The `latest` release step in a throwaway clone of this branch, with the real tags: ``` $ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30 Added v0.53.0 to CHANGELOG.md from 27 changeset(s). $ ls .changeset changelog.cjs config.json README.md $ sed -n 1,9p CHANGELOG.md ## v0.53.0 (2026-10-30) ### Breaking changes - **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316)) The deprecated import and alias extensions are removed. The `*ImportRules` arrays, including `HorizontalRuleImportRules`, stay. $ grep -n '^### ' CHANGELOG.md | head -8 3:### Breaking changes 28:### Behavior changes 54:### Features 62:### Fixes 108:### Performance 112:### Other 116:### Contributors 120:### All changes $ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md ### Behavior changes - **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303)) This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged. Verify: pages opened from editor links that relied on `window.opener`. $ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json # (kind, [(pr, behavior)]) [('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])] $ sed -n '/^### Contributors/,+2p' CHANGELOG.md ### Contributors @Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira $ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2 - [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou - [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry ``` (`### All changes` has 50 lines: the 48 commits after v0.52.0, without the `v0.52.0 (#9252)` bump commit, plus this branch's two commits.) Running again before that release PR is merged: ``` $ git tag v0.53.0 # tagged, but CHANGELOG.md on main has no v0.53.0 section $ npm_package_version=0.54.0 node scripts/changesets/release.mjs CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases. (exit 1) $ npm_package_version=0.53.1 node scripts/changesets/release.mjs Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release: - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier Run the release with the "minor" increment instead. (exit 1) ``` A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built, so the export check that follows fails as expected): ``` $ node scripts/npm/prepare-release.mjs [lexical] CHANGELOG.md lists pending changes as Unreleased [lexical] package.json references files that are not present in packages/lexical: ./dist/Lexical.dev.js $ sed -n 1,5p packages/lexical/CHANGELOG.md ## Unreleased Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut. ### Breaking changes $ git status --short CHANGELOG.md (clean: only the gitignored package copy changed) ```
Merged
This branch was successfully deployed
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
A custom element that returns
~"Hello"fromgetTextContent()currently producesHellofrom$getRoot().getTextContent()after DOM reconciliation. Reads during an update honor the override, but the reconciled root cache and text-content listeners lose it.Honor non-root element overrides when creating and refreshing the reconciliation text cache. Ordinary elements keep the existing incremental path. Custom parents bypass suffix text splicing because their text need not be a concatenation of child text. The existing moved-subtree size calculation remains unchanged.
Adds regression coverage for empty/non-empty custom elements, descendant-only edits, clean siblings, child suffix changes, editor-state replacement, moved ancestors and named slots. The custom node implements both text methods consistently; explicit assertions check text-length parity through ancestors and slots. No public API or dependency changes.
Closes #5336. Thanks to tecoad for the report. Implemented and validated with Codex assistance.
Test plan
Before
With unchanged production source at
8f9fec8961787aa7378b6c4f132ea491002b48aeand the new tests, including the custom node's matchinggetTextContentSize()override:After
The same command with the fix:
The affected core, list, table, clipboard and HTML unit suites also pass:
Type checking (
tsc --project tsconfig.test.json --noEmit), changed-file ESLint and Prettier, andgit diff --checkpass.Local validation used macOS arm64 and jsdom. Native browser and Windows/Linux runs were not performed for this semantic cache change.