Restore a single Lexical copy so the rich editor renders

Cherry-pick of the master fix onto the v2026.825.0-beta.1 base, so the
beta channel can ship a patched candidate without waiting for a full
rebase onto master.

The rich markdown editor fell back to its raw-source textarea on every
field, for any content including an empty one, with the render-time
error "LexicalBuilder.fromEditor: The given editor was created with
LexicalBuilder 0.48.0 but this version is 0.49.0. A project should have
exactly one copy of LexicalBuilder".

Root pnpm overrides pinned the Lexical family to 0.49.0 while
@mdxeditor/editor declares lexical ^0.48.0 — a caret on a 0.x version
pins the minor, so the override forced the editor past the only line it
supports (0.49 also carried breaking node-config changes). The override
list was incomplete besides: @lexical/extension, @lexical/history, and
@lexical/internal are reached transitively and stayed on 0.48, so the
graph mixed both lines and the LexicalBuilder invariant threw. The
browser bundle carried two @lexical/extension instances as a result.

Drop the Lexical entries from the root overrides (react, react-dom, and
rollup stay) and pin the app's own lexical and @lexical/link to 0.48.0,
so the whole graph resolves through the editor's supported line. The app
subclasses LinkNode for mention-aware links and registers it into the
editor's instance, so node identity depends on this being one copy.

Add a resolution-graph test that fails fast on a mixed graph rather than
waiting for a render crash: it asserts the app and the editor resolve
the same lexical copy, that @lexical/link and the transitively-reached
@lexical/extension sit on that version, and that the version satisfies
the editor's declared range.

The lockfile is regenerated against this base rather than taken from
master — the beta base predates several unrelated dependency bumps, so
master's lockfile does not describe this tree. Only Lexical resolutions
move; every other entry is unchanged. The conflict on ui/package.json
was lucide-react version drift, resolved in favour of this base.

Tested on the beta base: ui typecheck clean; the new resolution test
passes (3); mention-deletion, mention-aware-link-node, and
MarkdownEditor suites pass (42); the lockfile now resolves the whole
Lexical family to a single 0.48.0 line; the built bundle went from two
LexicalBuilder registrations to one. A probe rendering the real editor
(no mock) returns no fallback for empty and plain-prose content, where
both previously fell back. Prose containing bare angle brackets still
falls back on this base — that is a separate editor bug, not present on
master either, and out of scope here.
This commit is contained in:
Devin Foley committed 2026-08-27 09:31:40 -07:00
1 parent bef9288669
commit fd1831ea3c
4 files changed
+252 -251

No files matched your search

+1 -11
View File
@@ -88,17 +88,7 @@
"overrides": {
"rollup": ">=4.59.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"lexical": "0.49.0",
"@lexical/clipboard": "0.49.0",
"@lexical/link": "0.49.0",
"@lexical/list": "0.49.0",
"@lexical/markdown": "0.49.0",
"@lexical/plain-text": "0.49.0",
"@lexical/react": "0.49.0",
"@lexical/rich-text": "0.49.0",
"@lexical/selection": "0.49.0",
"@lexical/utils": "0.49.0"
"react-dom": "^19.2.8"
}
}
}