Skip to content
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

Issue: React Hydration Error in InlineRichTextEditor Component #222

Open
omaratpxt opened this issue Dec 31, 2024 · 1 comment
Open

Issue: React Hydration Error in InlineRichTextEditor Component #222

omaratpxt opened this issue Dec 31, 2024 · 1 comment

Comments

@omaratpxt
Copy link

When using the InlineRichTextEditor component, the following error occurs during server-side rendering:

Unhandled Runtime Error
Error: Hydration failed because the initial UI does not match what was rendered on the server.
See more info here: https://nextjs.org/docs/messages/react-hydration-error

Expected server HTML to contain a matching <div> in <div>.

...
  <InlineRichTextEditor>
    <div>
    ^^^^^
      <LexicalComposer>
        ...
          <ContentEditableElementImpl>
            <div>

Environment:

•	Next.js: 14
•	React: 19
•	Node.js: 22

Temporary Fix:

The issue has been temporarily resolved by wrapping the InlineRichTextEditor in a client-side-only component using use client. This ensures the component skips server-side rendering.

References:

•	[Next.js Hydration Error Docs](https://nextjs.org/docs/messages/react-hydration-error)
@4leite
Copy link
Contributor

4leite commented Jan 11, 2025

@omaratpxt The editor itself needs to be a client component, but there is a server render function that is exported in non-browser contexts. I haven't tested this with React 19 yet. Can you post a link to your code base, or a minimal reproduction that I can run to test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants