Skip to content

[Breaking Changes][lexical-link][lexical-list][lexical-react] Chore: Remove a subset of v0.32.1-deprecated exports - #8704

Merged
etrepum merged 2 commits into
meta:mainfrom
etrepum:claude/dazzling-mccarthy-tktb04
Jun 16, 2026
Merged

etrepum merged 2 commits into
meta:mainfrom
etrepum:claude/dazzling-mccarthy-tktb04

Conversation

@etrepum

@etrepum etrepum commented Jun 16, 2026 •

Copy link
Copy Markdown
Collaborator

Breaking Changes

Removes a subset of the public API surface that was already marked @deprecated in the v0.32.1 release (2025-06-04, more than 12 months ago) and is still exported and deprecated on main. This PR is scoped to the deprecations with no real consumers in Meta's www codebase; the remaining ones are handled in a follow-up. Each removal includes the implementation and the Flow type stubs (*.js.flow), and a docs example that referenced one of them was migrated to the supported replacement.

Removed exports

  • @lexical/link: toggleLink (use $toggleLink).
  • @lexical/list: insertList and removeList (use $insertList / $removeList from an update or command listener).
  • @lexical/react: the ContentEditable Props type alias (use ContentEditableProps).

Un-deprecated

  • lexical: $nodesOfType keeps its @deprecated tag removed because it still has many consumers. The recommendation to prefer LexicalEditor.registerMutationListener with skipInitialization: false when you need to track nodes over time is kept in the JSDoc.

Notes

  • The docs example in concepts/commands.md was updated from insertList(editor, 'ul') to $insertList('ul').
  • The remaining v0.32.1 deprecations still have www consumers and are intentionally left for a separate PR: KEY_MODIFIER_COMMAND, $nodesOfType (now un-deprecated rather than removed), $wrapNodes, the $cloneWithProperties / $selectAll re-exports from @lexical/selection, the deprecated @lexical/table functions ($insertTableRow, $insertTableColumn, $deleteTableColumn, and the *__EXPERIMENTAL aliases), LexicalNode.getCommonAncestor, the @internal ElementNode / ListItemNode can* methods, and the LexicalNestedComposer initialNodes prop.
  • Symbols annotated @deprecated after v0.32.1 (e.g. the generic signature casts and the *Extension migrations) are also left in place, since they have not been deprecated for 12 months.

Test plan

Before

The symbols above were still exported and @deprecated on main, and a docs example referenced insertList.

After

The scoped exports are removed (and $nodesOfType is un-deprecated), with the docs example migrated to the supported replacement. The following all pass:

  • pnpm tsc (type check)
  • pnpm lint (eslint)
  • pnpm prettier
  • pnpm flow (Flow stubs remain self-consistent)
  • pnpm test-unit for the affected packages (@lexical/link, @lexical/list, @lexical/react, and lexical)

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 16, 2026
@vercel

vercel Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Jun 16, 2026 4:09pm
lexical-playground Ready Ready Preview, Comment Jun 16, 2026 4:09pm

Request Review

@potatowagon potatowagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by Navi (Tater Thoughts Bobblehead) on behalf of @potatowagon.

Assessment: LGTM ✅ — Breaking change: Remove exports deprecated since v0.32.1

What this PR does: Removes all deprecated APIs that were marked for removal since v0.32.1. This is a clean-up PR removing dead code that has had deprecated aliases/shims available for at least one minor version.

What I checked:

  • Logic correctness: Each removal is a straightforward deletion of deprecated wrappers/aliases that simply delegated to the canonical replacement. No behavioral changes to the surviving APIs.
  • Removed exports verified:
    • @lexical/link: toggleLink (alias for $toggleLink)
    • @lexical/list: insertList, removeList (editor-wrapping aliases for $insertList, $removeList), ListItemNode.canInsertAfter, ListItemNode.canReplaceWith
    • @lexical/react: Props type alias (→ ContentEditableProps), LexicalNestedComposer.initialNodes prop
    • @lexical/selection: $cloneWithProperties, $selectAll (re-exports from lexical), $wrapNodes (+$wrapNodesImpl), trimTextContentFromAnchor alias
    • @lexical/table: $insertTableRow, $insertTableColumn, $deleteTableColumn (old non-merged-cell APIs), $insertTableRow__EXPERIMENTAL, $insertTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $deleteTableColumn__EXPERIMENTAL (rename aliases)
    • lexical core: KEY_MODIFIER_COMMAND, $nodesOfType, LexicalNode.getCommonAncestor, ElementNode.canReplaceWith, ElementNode.canInsertAfter, ElementNode.canMergeWith, isModifier util
  • Test cleanup: Deprecated test cases properly removed (LexicalNestedComposer initialNodes tests, $nodesOfType tests, getCommonAncestor tests). Existing test updated to use $dfs instead of $nodesOfType.
  • Flow types: All .js.flow files consistently updated to remove deprecated declarations.
  • Edge cases: $wrapNodesImpl was also exported — it's removed alongside $wrapNodes. The canMergeWith removal from ElementNode base class is safe since the override in ListItemNode remains.
  • No regressions: Core unit tests (22.x+24.x), browser tests, integrity tests, integration tests all pass. E2e tests partially pending but no failures.

www compat check: ⚠️ This is a breaking change PR. Meta's www codebase consumes Lexical. The removed APIs were deprecated since v0.32.1, so www should have already migrated during the deprecation period. Key items to verify internally:

  • $nodesOfType → use registerMutationListener with skipInitialization: false
  • KEY_MODIFIER_COMMAND → use KEY_DOWN_COMMAND and check modifiers directly
  • getCommonAncestor → use $getCommonAncestor
  • $wrapNodes → use $setBlocksType
  • toggleLink → $toggleLink
  • insertList/removeList → $insertList/$removeList inside editor.update()
  • canReplaceWith/canInsertAfter/canMergeWith on ElementNode — these were @internal deprecated, only ListItemNode override was meaningful (and it's also removed)
  • Table __EXPERIMENTAL aliases → use the non-experimental names

If www has completed the migration (which it should have given the deprecation window), this is safe to land. If any internal callsites remain, they'd need to be updated before upgrading to this version.

Verdict: Clean mechanical deletion of deprecated code. All surviving APIs remain intact. CI core green. Ready to approve pending full e2e completion.

@zurfyx zurfyx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to have @potatowagon comments before we proceed this one, it's going to block Meta for a while:

  • $nodesOfType → 75 consumer files
  • __EXPERIMENTAL table aliases → 7 consumer files
  • KEY_MODIFIER_COMMAND → 10 consumer files
  • $wrapNodes → 6 consumer files
  • canReplaceWith/canInsertAfter overrides → 2 consumer files
  • getCommonAncestor → 1 consumer file

Safe to remove:

  • toggleLink
  • insertList / removeList

@potatowagon

Copy link
Copy Markdown
Contributor

I'd love to have @potatowagon comments before we proceed this one, it's going to block Meta for a while:

  • $nodesOfType → 75 consumer files
  • __EXPERIMENTAL table aliases → 7 consumer files
  • KEY_MODIFIER_COMMAND → 10 consumer files
  • $wrapNodes → 6 consumer files
  • canReplaceWith/canInsertAfter overrides → 2 consumer files
  • getCommonAncestor → 1 consumer file

Safe to remove:

  • toggleLink
  • insertList / removeList

thanks for flagging, lets put this PR on hold first. ill go audit whats the effort and risk required to clean these up

@etrepum

etrepum commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

$nodesOfType seems like we could probably remove the @deprecated flag and keep it, the reason for its deprecation is mostly perf related if called from editor.update because it has to do a full traversal.

For the others we could consider adding warnOnlyOnce gates to calling the functions as a stronger reminder that they are going to be removed, instead of removing them all now?

@potatowagon

Copy link
Copy Markdown
Contributor

Following up on my earlier LGTM — I went back and did a proper backwards-compatibility audit against Meta's internal www codebase (which consumes Lexical via the synced Haste modules), since @gerardrovira flagged that this would block internal migration. My audit confirms his findings: this is not safe to land against current www as-is. Here's the breakdown.

🔴 Requires migration before this can land

Removed API www consumer files Effort / risk
$nodesOfType → registerMutationListener({skipInitialization: false}) ~71 High. Not a rename — it's a behavioral migration from synchronous tree traversal to listener registration. This is the real cost and risk center.
KEY_MODIFIER_COMMAND → KEY_DOWN_COMMAND + manual modifier check 10 Medium. Each site re-implements modifier detection inline.
$wrapNodes → $setBlocksType 6 Low — mostly mechanical.
$insertTableRow__EXPERIMENTAL / $insertTableColumn__EXPERIMENTAL / $deleteTableRow__EXPERIMENTAL / $deleteTableColumn__EXPERIMENTAL → *AtSelection / *AtNode 3 (Wiki + MLC table plugins) Low — mechanical.
trimTextContentFromAnchor → $trimTextContentFromAnchor ~5 Low — $-prefixed import.
$selectAll / $cloneWithProperties re-exports from @lexical/selection ~11 Low — re-point imports to lexical (symbols still exported there).
LexicalNode.getCommonAncestor → $getCommonAncestor 1 Low — single real call site.
ElementNode.canReplaceWith / canInsertAfter (@internal overrides) 2 Low.

🟢 Safe to remove (0 real www consumers, confirming the PR)

  • toggleLink — the only grep hit is unrelated AntD third-party code.
  • insertList / removeList — no non-$ imports in www.
  • ContentEditable Props type alias — only appears in a .txt bundle artifact, no real source consumers.

Recommendation

The $nodesOfType removal (~71 files, behavioral change) is the blocker. I'd suggest one of:

  1. Sequence the migration first — land the www-side migrations (or compatibility shims) before this PR, especially for $nodesOfType; or
  2. Split this PR — let the zero-consumer removals (toggleLink, insertList/removeList, the Props alias) land now, and hold the high-consumer removals until www has migrated.

Happy to help drive the internal migration diffs on the www side. Thanks for the patience on the re-review.


Audit performed with the assistance of Navi (AI agent) on my behalf. Numbers cross-checked against @gerardrovira's counts.

@etrepum

etrepum commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

I'll scope this down to the ones that are safe now and we can do another pass after the next release. Given the high use of $nodesOfType we can remove the @deprecated flag from that but leave the suggestion in the jsdoc.

… Remove a subset of v0.32.1-deprecated exports

Removes the exports that were @deprecated as of the v0.32.1 release
(2025-06-04, >12 months ago) and have no real consumers in Meta's www
codebase:

- @lexical/link: toggleLink (use $toggleLink)
- @lexical/list: insertList, removeList (use $insertList / $removeList
  from an update or command listener)
- @lexical/react: the ContentEditable `Props` type alias (use
  ContentEditableProps)

Also removes the @deprecated tag from lexical's $nodesOfType, which still
has many consumers, while keeping the recommendation to prefer a mutation
listener. Flow stubs are updated to match.

The other v0.32.1 deprecations (KEY_MODIFIER_COMMAND, $wrapNodes, the
$cloneWithProperties/$selectAll re-exports, the deprecated @lexical/table
functions, getCommonAncestor, the @internal can* methods and the
NestedComposer initialNodes prop) will be handled in a separate PR.

https://claude.ai/code/session_01Uh2MJVjhWz9CpPgAr97MBs
@etrepum
etrepum force-pushed the claude/dazzling-mccarthy-tktb04 branch from 73aaae0 to 3c645cf Compare June 16, 2026 15:36
@etrepum etrepum changed the title [lexical][lexical-selection][lexical-table][lexical-list][lexical-link][lexical-react] Breaking change: Remove exports deprecated since v0.32.1 [lexical][lexical-link][lexical-list][lexical-react] Breaking change: Remove a subset of v0.32.1-deprecated exports Jun 16, 2026
@etrepum etrepum changed the title [lexical][lexical-link][lexical-list][lexical-react] Breaking change: Remove a subset of v0.32.1-deprecated exports [Breaking Changes][lexical][lexical-link][lexical-list][lexical-react] Chore: Remove a subset of v0.32.1-deprecated exports Jun 16, 2026
@etrepum

etrepum commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

I went with the conservative path and only removed exports that are unused in www, and un-deprecated $nodesOfType. We can defer the rest to another pass later.

@etrepum etrepum changed the title [Breaking Changes][lexical][lexical-link][lexical-list][lexical-react] Chore: Remove a subset of v0.32.1-deprecated exports [Breaking Changes][lexical-link][lexical-list][lexical-react] Chore: Remove a subset of v0.32.1-deprecated exports Jun 16, 2026
@etrepum
etrepum requested a review from potatowagon June 16, 2026 16:18
@etrepum
etrepum added this pull request to the merge queue Jun 16, 2026
Merged via the queue into meta:main with commit e02e669 Jun 16, 2026
40 checks passed
@etrepum
etrepum deleted the claude/dazzling-mccarthy-tktb04 branch June 16, 2026 18:01
@etrepum etrepum mentioned this pull request Jun 25, 2026
AlessioGr added a commit to payloadcms/payload that referenced this pull request Sep 11, 2026
Upgrades `lexical` and every installed `@lexical/*` package from
`0.41.0` to `0.50.0` for Payload 3.x. Updates the dependency pins,
lockfile, and `lexicalTargetVersion`.

Also exposes the 15 React entry points added on main in
[#17554](#17554) through
`@payloadcms/richtext-lexical/lexical/react/*`, so custom features can
use these APIs through Payload.

## Breaking changes

**No application changes or data migration are needed when using
Payload's built-in rich text features.**

If you maintain custom rich text features, check that they still compile
and that custom content loads, copies, and pastes correctly. Lexical
removed some older APIs, tightened TypeScript types, and changed how
custom nodes are loaded and copied. Tests that inspect the editor's HTML
may also need updated selectors or snapshots because Lexical adds some
internal markup.

**Do not install `lexical` or `@lexical/*` yourself for use with
Payload.** Remove any direct dependencies you added for the editor and
use Payload's re-exports from `@payloadcms/richtext-lexical/lexical` and
`@payloadcms/richtext-lexical/lexical/*`. Payload supplies the matching
versions; mixing versions can break the editor. This is the existing
[custom feature
requirement](https://payloadcms.com/docs/rich-text/custom-features).

The 3.x Markdown implementation and converter defaults are preserved.
This does not backport the v4 Markdown API changes.

## Breaking changes and Payload migrations

Reviewed
[0.42.0](https://github.com/facebook/lexical/releases/tag/v0.42.0),
[0.43.0](https://github.com/facebook/lexical/releases/tag/v0.43.0),
[0.44.0](https://github.com/facebook/lexical/releases/tag/v0.44.0),
[0.45.0](https://github.com/facebook/lexical/releases/tag/v0.45.0),
[0.46.0](https://github.com/facebook/lexical/releases/tag/v0.46.0),
[0.47.0](https://github.com/facebook/lexical/releases/tag/v0.47.0),
[0.48.0](https://github.com/facebook/lexical/releases/tag/v0.48.0),
[0.49.0](https://github.com/facebook/lexical/releases/tag/v0.49.0),
[0.50.0](https://github.com/facebook/lexical/releases/tag/v0.50.0).
Listed below are breaking API/type changes and behavior changes
explicitly identified as breaking in the release notes. Deprecations and
routine bug fixes are omitted. **Yes** means we had to change Payload
code; **No** means no Payload migration was required.

| Release | Breaking change | Required migration in Payload | Changes
made |
| ------- |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ----------------------------- |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 0.42 | [Experimental `hasFitNestedTables` moves out of the table
package into the
playground](meta/lexical#8210). | No | - |
| 0.42 | [The deprecated context-menu plugin is
removed](meta/lexical#8199). | Yes | Removed
the invalid `LexicalContextMenuPlugin` proxy and package export. Custom
consumers must use
`@payloadcms/richtext-lexical/lexical/react/LexicalNodeContextMenuPlugin`
and adapt to its node-context-menu API. |
| 0.43 | [Nested editors delegate asynchronously to their
parent](meta/lexical#8308), restoring the
behavior from before 0.42.0. | No | - |
| 0.45 | [`$getReconciledDirection` now inherits direction through
shadow-root nodes](meta/lexical#8479). | No
| - |
| 0.45 | [Backspace at the start of a non-empty block preserves the
current block type and
formatting](meta/lexical#8493). | No | - |
| 0.45 | [Moving nodes between parents adjusts selection
offsets](meta/lexical#8501). | No | - |
| 0.45 | [Markdown shortcuts can trigger when IME composition
commits](meta/lexical#8503). | No | - |
| 0.45 | [Rich/plain text automatically removes empty inline
elements](meta/lexical#8497). | No | - |
| 0.45 | [Triple-click selection normalization moves from core into
rich/plain text
registration](meta/lexical#8520). Editors
bypassing that registration must add
`NormalizeTripleClickSelectionExtension`. | No | - |
| 0.45 | [`DOMSlot` and the DOM rendering override APIs are
generalized](meta/lexical#8519); playground
`AutocompleteNode` is replaced by `VisibleLineBreakExtension`. | No | -
|
| 0.46 | [`static importJSON` widens its parameter to
`SerializedLexicalNode & Record<string,
unknown>`](#17554). Overrides
using serialized interfaces can fail TypeScript checks. | No | - |
| 0.46 | [Node lookups and traversal no longer infer unchecked subclass
types](meta/lexical#8661). Explicit
unchecked traversal generics are deprecated. | Yes | Removed the upload
drawer’s assumption that a node lookup returns `UploadNode`. Added
`$isUploadNode` before reading or updating upload data. |
| 0.46 | [DOM lookups of the editor root return `RootNode` instead of
`null`](meta/lexical#8588).
Selection-capture handling is also generalized beyond decorators. | No |
- |
| 0.46 | [`insertNodes` preserves leading line breaks, and managed line
breaks receive a DOM
marker](meta/lexical#8615). | No | - |
| 0.46 | [Experimental DOM-import rules register through node
extensions](meta/lexical#8662); the separate
per-package import extensions become deprecated aliases. | No | - |
| 0.46 | [Experimental named slots change the Yjs sync
signature](meta/lexical#8603):
`syncLexicalUpdateToYjsV2__EXPERIMENTAL` gains a `dirtyLeaves`
parameter. | No | - |
| 0.46 | [Copying an element through `NodeSelection` includes its
children](meta/lexical#8603), instead of
copying an empty shell. | No | - |
| 0.46 | [Previously deprecated exports are
removed](meta/lexical#8704): `toggleLink`,
`insertList`, `removeList`, and ContentEditable’s `Props` alias.
Replacements are `$toggleLink`, `$insertList`, `$removeList`, and
`ContentEditableProps`. | No | - |
| 0.47 | [React 17 support is
removed](meta/lexical#8782); React 18 or
later is required. | No | - |
| 0.47 | [Segmented text temporarily switches to normal mode during IME
composition while keeping its
DOM](meta/lexical#8784). Subclasses must
tolerate that temporary mode. | No | - |
| 0.49 | [Built-in nodes adopt
`$config()`](meta/lexical#8640). Direct
static `importJSON`, `importDOM`, `clone`, and `transform`
implementations change; `__type` becomes readonly and automatic node
construction needs zero-argument defaults. Custom static implementations
remain supported. | No | - |
| 0.49 | [`LexicalCommand<T>` checks its payload type more
strictly](meta/lexical#8877).
`LexicalCommand<unknown>` is no longer a safe catch-all. | Yes | Focus
and blur commands were incorrectly registered with `MouseEvent`. Removed
the explicit types so Lexical infers `FocusEvent`. |
| 0.50 | [Named-slot values cannot be replaced with
`LexicalNode.replace()`](meta/lexical#8938).
Block converters also [skip slot
values](meta/lexical#8905). | No | - |
| 0.50 | [Lexical JSON clipboard copying checks
`excludeFromCopy('clone')`, not
`'html'`](meta/lexical#8995). | No | - |

Also updated the copied table action menu for merged-cell bounds, header
toggles, and merge/unmerge selection, and fixed the upload alignment
test’s image selector. Formatting and diff checks pass for the upload
selector fix.

Verified all 15 new entry points through source and published export
maps with runtime imports and TypeScript checks. ESLint and formatting
checks pass.

## Previous Lexical upgrades

- [#15760](#15760) — 0.35.0 →
0.41.0
- [#13715](#13715) — 0.34.0 →
0.35.0
- [#13622](#13622) — 0.28.0 →
0.34.0

This branch was successfully deployed

2 active deployments
Preview – lexical — 02e1f3b2 Deployed Jun 16, 2026 by vercel[bot]
Preview – lexical-playground — 02e1f3b2 Deployed Jun 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants