Skip to content

[lexical-website] Documentation Update: fix the collaboration snippets and two stale playground references - #9225

Merged
etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-collab-fixes
Sep 24, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-collab-fixes

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

Six corrections across the collaboration guides.

collaboration/faq.md:

  1. createNoOpProvider does not typecheck — its awareness object omits
    setLocalStateField, which ProviderAwareness requires. Every no-op
    provider in the repo includes it.
  2. withHeadlessCollaborationEditor is not exported, but the React guide
    imports it from this file.

collaboration/react.md:

  1. <CollaborationPlugin> is rendered without shouldBootstrap, which is
    a required prop. The example this guide is based on passes it.
  2. The import path names a file that does not exist —
    ./withHeadlessCollaborationEditor. The FAQ snippet it refers to is
    createHeadlessCollaborativeEditor.ts.
  3. createBootstrappedYDoc returns an empty document — it constructs
    const yDoc = new Doc() that nothing is ever bound to, while the editor
    syncs into the Doc created inside withHeadlessCollaborationEditor. The
    callback already receives that one as binding.doc.
  4. Two stale playground references — ImageComponent and
    StickyComponent are described as using LexicalNestedComposer, which
    appears nowhere in the playground (both use
    LexicalExtensionEditorComposer), and PollOptionComponent is described
    as using clientID from the Yjs context, which
    CollaborationContextType does not have (it reads name).

Test plan

Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the checks are the type requirements and the
playground's actual imports.

Before

$ grep -n "setLocalState" packages/lexical-website/docs/collaboration/faq.md
149:        setLocalState: emptyFunction,

$ grep -n "setLocalStateField" packages/lexical-yjs/src/index.ts
55:  setLocalStateField: (field: string, value: unknown) => void;

$ grep -n "function withHeadlessCollaborationEditor" packages/lexical-website/docs/collaboration/faq.md
73:  function withHeadlessCollaborationEditor<T>(

$ grep -n "shouldBootstrap" packages/lexical-website/docs/collaboration/react.md
$ grep -n "shouldBootstrap" packages/lexical-react/src/LexicalCollaborationPlugin.tsx
55:  shouldBootstrap: boolean;

$ grep -rn "LexicalNestedComposer" packages/lexical-playground/src | wc -l
0
$ grep -rn "clientID" packages/lexical-playground/src/nodes/PollComponent.tsx | wc -l
0

setLocalStateField and shouldBootstrap are both non-optional, so the
snippets do not typecheck; the two playground symbols do not exist.

After

$ grep -n "setLocalStateField\|export function withHeadlessCollaborationEditor" packages/lexical-website/docs/collaboration/faq.md
73:  export function withHeadlessCollaborationEditor<T>(
150:        setLocalStateField: emptyFunction,

$ grep -n "shouldBootstrap\|createHeadlessCollaborativeEditor\|binding.doc" packages/lexical-website/docs/collaboration/react.md
104:          shouldBootstrap={true}
124:import {withHeadlessCollaborationEditor} from './createHeadlessCollaborativeEditor';
133:    return binding.doc;

$ grep -n "LexicalExtensionEditorComposer\|from the collaboration context" packages/lexical-website/docs/collaboration/react.md
229:- [`ImageComponent`](...) - features use of the `LexicalExtensionEditorComposer` for its nested caption editor.
230:- [`PollOptionComponent`](...) - showcases poll implementation using `name` from the collaboration context.
231:- [`StickyComponent`](...) - features use of the `LexicalExtensionEditorComposer` for its nested editor as well as sticky note position real-time sync.

binding.doc is the Doc passed to createBinding
(collaboration/faq.md:82-85), and the callback's signature already provides
it (:75). Playground sources:
packages/lexical-playground/src/nodes/ImageComponent.tsx:14,492,
StickyComponent.tsx:14,236, PollComponent.tsx:58
(const {name: username} = useCollaborationContext()), with the context type
at packages/lexical-react/src/LexicalCollaborationContextUtils.ts:19-24.

…s and two stale playground references

## Description

Six corrections across the collaboration guides.

`collaboration/faq.md`:

1. **`createNoOpProvider` does not typecheck** — its `awareness` object omits
   `setLocalStateField`, which `ProviderAwareness` requires. Every no-op
   provider in the repo includes it.
2. **`withHeadlessCollaborationEditor` is not exported**, but the React guide
   imports it from this file.

`collaboration/react.md`:

3. **`<CollaborationPlugin>` is rendered without `shouldBootstrap`**, which is
   a required prop. The example this guide is based on passes it.
4. **The import path names a file that does not exist** —
   `./withHeadlessCollaborationEditor`. The FAQ snippet it refers to is
   `createHeadlessCollaborativeEditor.ts`.
5. **`createBootstrappedYDoc` returns an empty document** — it constructs
   `const yDoc = new Doc()` that nothing is ever bound to, while the editor
   syncs into the `Doc` created inside `withHeadlessCollaborationEditor`. The
   callback already receives that one as `binding.doc`.
6. **Two stale playground references** — `ImageComponent` and
   `StickyComponent` are described as using `LexicalNestedComposer`, which
   appears nowhere in the playground (both use
   `LexicalExtensionEditorComposer`), and `PollOptionComponent` is described
   as using `clientID` from the Yjs context, which
   `CollaborationContextType` does not have (it reads `name`).

## Test plan

Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the checks are the type requirements and the
playground's actual imports.

### Before

```
$ grep -n "setLocalState" packages/lexical-website/docs/collaboration/faq.md
149:        setLocalState: emptyFunction,

$ grep -n "setLocalStateField" packages/lexical-yjs/src/index.ts
55:  setLocalStateField: (field: string, value: unknown) => void;

$ grep -n "function withHeadlessCollaborationEditor" packages/lexical-website/docs/collaboration/faq.md
73:  function withHeadlessCollaborationEditor<T>(

$ grep -n "shouldBootstrap" packages/lexical-website/docs/collaboration/react.md
$ grep -n "shouldBootstrap" packages/lexical-react/src/LexicalCollaborationPlugin.tsx
55:  shouldBootstrap: boolean;

$ grep -rn "LexicalNestedComposer" packages/lexical-playground/src | wc -l
0
$ grep -rn "clientID" packages/lexical-playground/src/nodes/PollComponent.tsx | wc -l
0
```

`setLocalStateField` and `shouldBootstrap` are both non-optional, so the
snippets do not typecheck; the two playground symbols do not exist.

### After

```
$ grep -n "setLocalStateField\|export function withHeadlessCollaborationEditor" packages/lexical-website/docs/collaboration/faq.md
73:  export function withHeadlessCollaborationEditor<T>(
150:        setLocalStateField: emptyFunction,

$ grep -n "shouldBootstrap\|createHeadlessCollaborativeEditor\|binding.doc" packages/lexical-website/docs/collaboration/react.md
104:          shouldBootstrap={true}
124:import {withHeadlessCollaborationEditor} from './createHeadlessCollaborativeEditor';
133:    return binding.doc;

$ grep -n "LexicalExtensionEditorComposer\|from the collaboration context" packages/lexical-website/docs/collaboration/react.md
229:- [`ImageComponent`](...) - features use of the `LexicalExtensionEditorComposer` for its nested caption editor.
230:- [`PollOptionComponent`](...) - showcases poll implementation using `name` from the collaboration context.
231:- [`StickyComponent`](...) - features use of the `LexicalExtensionEditorComposer` for its nested editor as well as sticky note position real-time sync.
```

`binding.doc` is the `Doc` passed to `createBinding`
(`collaboration/faq.md:82-85`), and the callback's signature already provides
it (`:75`). Playground sources:
`packages/lexical-playground/src/nodes/ImageComponent.tsx:14,492`,
`StickyComponent.tsx:14,236`, `PollComponent.tsx:58`
(`const {name: username} = useCollaborationContext()`), with the context type
at `packages/lexical-react/src/LexicalCollaborationContextUtils.ts:19-24`.
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
lexical Ready Ready Preview Sep 24, 2026 4:48pm UTC
lexical-playground Ready Ready Preview Sep 24, 2026 4:48pm UTC

Request Review

@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 Sep 24, 2026
@etrepum
etrepum added this pull request to the merge queue Sep 24, 2026
Merged via the queue into meta:main with commit be65fdc Sep 24, 2026
42 checks passed
@etrepum etrepum mentioned this pull request Sep 28, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — c0075cab Deployed Sep 24, 2026 by vercel[bot]
Preview – lexical-playground — c0075cab Deployed Sep 24, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants