-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lexical-react] Bug Fix: LexicalTypeaheadMenuPlugin SSR error: ReferenceError: document is not defined #6794
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the LexicalMenu anchorElementRef type should change to match the new expectations rather than using a cast. It's a mutable object, the contents can change from not-null to null at any time (at least per the type contract)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go, I will apply the small suggested nit and assuming the e2e test suite looks good then it will be merged. Thank you!
Description
Used
CAN_USE_DOM
to check if the DOM can be used when accessing the document object in theuseMenuAnchorRef
hook. This prevents runtime errors when the hook is used by a plugin in SSR.Closes #6716
Test plan
Unit test has been added for
useMenuAnchorRef
.