Skip to content

Bug: LexicalTypeaheadMenuPlugin SSR error: ReferenceError: document is not defined #6716

@luisrudge

Description

@luisrudge

It was mentioned before that you have a util to check if the DOM can be used. I don't think this check is being used in the LexicalTypeaheadMenuPlugin, considering I'm getting
this error:

ReferenceError: document is not defined
    at useMenuAnchorRef (....../node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.dev.mjs:337:74)
    at LexicalTypeaheadMenuPlugin (....../node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.dev.mjs:534:28)

I'm running a remix project and trying to import the playground. I ran into all sorts of problems, so I used React.lazy to import the component only in the frontend. That solved all of the issues, however the above error is logged during server rendering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions