Repository navigation
[Breaking Changes][lexical-link][lexical-list][lexical-react] Chore: Remove a subset of v0.32.1-deprecated exports - #8704
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f8d5dc4 to
73aaae0
Compare
potatowagon
left a comment
There was a problem hiding this comment.
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:Propstype alias (→ContentEditableProps),LexicalNestedComposer.initialNodesprop@lexical/selection:$cloneWithProperties,$selectAll(re-exports from lexical),$wrapNodes(+$wrapNodesImpl),trimTextContentFromAnchoralias@lexical/table:$insertTableRow,$insertTableColumn,$deleteTableColumn(old non-merged-cell APIs),$insertTableRow__EXPERIMENTAL,$insertTableColumn__EXPERIMENTAL,$deleteTableRow__EXPERIMENTAL,$deleteTableColumn__EXPERIMENTAL(rename aliases)lexicalcore:KEY_MODIFIER_COMMAND,$nodesOfType,LexicalNode.getCommonAncestor,ElementNode.canReplaceWith,ElementNode.canInsertAfter,ElementNode.canMergeWith,isModifierutil
- Test cleanup: Deprecated test cases properly removed (LexicalNestedComposer initialNodes tests, $nodesOfType tests, getCommonAncestor tests). Existing test updated to use
$dfsinstead of$nodesOfType. - Flow types: All .js.flow files consistently updated to remove deprecated declarations.
- Edge cases:
$wrapNodesImplwas also exported — it's removed alongside$wrapNodes. ThecanMergeWithremoval 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:
$nodesOfType→ useregisterMutationListenerwithskipInitialization: falseKEY_MODIFIER_COMMAND→ useKEY_DOWN_COMMANDand check modifiers directlygetCommonAncestor→ use$getCommonAncestor$wrapNodes→ use$setBlocksTypetoggleLink→$toggleLinkinsertList/removeList→$insertList/$removeListinsideeditor.update()canReplaceWith/canInsertAfter/canMergeWithon ElementNode — these were@internaldeprecated, only ListItemNode override was meaningful (and it's also removed)- Table
__EXPERIMENTALaliases → 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
left a comment
There was a problem hiding this comment.
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 |
|
For the others we could consider adding |
|
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
🟢 Safe to remove (0 real www consumers, confirming the PR)
RecommendationThe
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. |
|
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 |
… 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
73aaae0 to
3c645cf
Compare
|
I went with the conservative path and only removed exports that are unused in www, and un-deprecated |
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
Breaking Changes
Removes a subset of the public API surface that was already marked
@deprecatedin thev0.32.1release (2025-06-04, more than 12 months ago) and is still exported and deprecated onmain. 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:insertListandremoveList(use$insertList/$removeListfrom an update or command listener).@lexical/react: theContentEditablePropstype alias (useContentEditableProps).Un-deprecated
lexical:$nodesOfTypekeeps its@deprecatedtag removed because it still has many consumers. The recommendation to preferLexicalEditor.registerMutationListenerwithskipInitialization: falsewhen you need to track nodes over time is kept in the JSDoc.Notes
concepts/commands.mdwas updated frominsertList(editor, 'ul')to$insertList('ul').v0.32.1deprecations 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/$selectAllre-exports from@lexical/selection, the deprecated@lexical/tablefunctions ($insertTableRow,$insertTableColumn,$deleteTableColumn, and the*__EXPERIMENTALaliases),LexicalNode.getCommonAncestor, the@internalElementNode/ListItemNodecan*methods, and theLexicalNestedComposerinitialNodesprop.@deprecatedafterv0.32.1(e.g. the generic signature casts and the*Extensionmigrations) are also left in place, since they have not been deprecated for 12 months.Test plan
Before
The symbols above were still exported and
@deprecatedonmain, and a docs example referencedinsertList.After
The scoped exports are removed (and
$nodesOfTypeis un-deprecated), with the docs example migrated to the supported replacement. The following all pass:pnpm tsc(type check)pnpm lint(eslint)pnpm prettierpnpm flow(Flow stubs remain self-consistent)pnpm test-unitfor the affected packages (@lexical/link,@lexical/list,@lexical/react, andlexical)