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

Upgrading to React 19 broke the Markdown Editor #238

Open
khanakia opened this issue Jan 5, 2025 · 2 comments
Open

Upgrading to React 19 broke the Markdown Editor #238

khanakia opened this issue Jan 5, 2025 · 2 comments

Comments

@khanakia
Copy link

khanakia commented Jan 5, 2025

I just upgraded to React 19 and now if I add any Custom HTML tags it throws an error in the console

When I disabled the preview then it works fine

<MarkdownEditor
   enablePreview={false}
/>
The tag <statlistitem> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter. Error Component Stack
    at statlistitem (<anonymous>)
    at Markdown (index.js:163:35)
    at div (<anonymous>)
    at eval (preview.js:34:7)
    at eval (index.js:33:110)
    at div (<anonymous>)
    at div (<anonymous>)
    at div (<anonymous>)
    at MarkdownEditorInternal (index.js:71:7)
    at LoadableComponent (dynamic-BkHm8yrd.js:133:9)

Screenshot 2025-01-06 at 12 18 32 AM

@vojtaholik
Copy link

vojtaholik commented Jan 13, 2025

@khanakia this is rather a workaround than proper solution, but try disabling preview enablePreview={false} or adding the mdx component to preview context:

<MarkdownEditor
  previewProps={{
    components: {
      statlistitem: ({ children }) => children,
    },
  }}

@khanakia
Copy link
Author

I can't manually define statlistitem there could be any number of dynamically defined components.

The issue is because of React 19 have changed this https://react.dev/blog/2024/12/05/react-19#improvements-in-react-19

so ref should not be passed as 2nd argument anymore

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