Repository navigation
[lexical-website] Documentation Update: clone is synthesized for $config nodes, and fix a setSomeData typo - #9202
Merged
Conversation
…fig nodes, and fix a setSomeData typo
## Description
Two corrections in `concepts/node-cloning.md`:
1. The page opens by calling `clone` "a static method required by all Lexical
nodes". It is not required of a node that declares `$config()`: Lexical
synthesizes one when the class has no own static `clone`. `nodes.mdx`
already lists `static clone` among the methods `$config` provides, so the
two pages contradict each other today.
2. The "Node Mutations" example defines `setData` and then calls
`node.setSomeData("new data")`. Every other call on the page — seven of
them — uses `setData`.
## Test plan
Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the check is that the claim matches the synthesis code
and the example calls the method it defines.
### Before
```
$ sed -n '17p' packages/lexical-website/docs/concepts/node-cloning.md
The `clone` method is a static method required by all Lexical nodes that creates the next version of a node. However, it's important to understand that this is an **internal API** used by Lexical's state management system.
$ grep -n "setData\|setSomeData" packages/lexical-website/docs/concepts/node-cloning.md
39: setData(data: string): this {
46: node.setSomeData("new data");
90: setData(data: string): this {
...
```
The example calls a method that its own class does not define, and the
"required by all nodes" claim contradicts `nodes.mdx:341`.
### After
```
$ sed -n '17p' packages/lexical-website/docs/concepts/node-cloning.md
The `clone` method is a static method that creates the next version of a node. A node that declares [`$config()`](./nodes.mdx) has one synthesized for it and need not implement it — a hand-written `clone` is only required for a node that does not use `$config()`, or whose constructor has required arguments. Either way, it's important to understand that this is an **internal API** used by Lexical's state management system.
$ grep -n "setSomeData" packages/lexical-website/docs/concepts/node-cloning.md
$ sed -n '46p' packages/lexical-website/docs/concepts/node-cloning.md
node.setData("new data");
```
The synthesis is at `packages/lexical/src/LexicalUtils.ts:4956`
(`if (!hasOwnStaticMethod(klass, 'clone'))`), and the required-arguments caveat
is the `invariant` at `:4961-4969`.
potatowagon
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7 and
zurfyx
as code owners
September 23, 2026 06:32
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Sep 23, 2026
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
Two corrections in
concepts/node-cloning.md:clone"a static method required by all Lexicalnodes". It is not required of a node that declares
$config(): Lexicalsynthesizes one when the class has no own static
clone.nodes.mdxalready lists
static cloneamong the methods$configprovides, so thetwo pages contradict each other today.
setDataand then callsnode.setSomeData("new data"). Every other call on the page — seven ofthem — uses
setData.Test plan
Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that the claim matches the synthesis codeand the example calls the method it defines.
Before
The example calls a method that its own class does not define, and the
"required by all nodes" claim contradicts
nodes.mdx:341.After
The synthesis is at
packages/lexical/src/LexicalUtils.ts:4956(
if (!hasOwnStaticMethod(klass, 'clone'))), and the required-arguments caveatis the
invariantat:4961-4969.