QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.25k stars 59 forks source link

Issue while switching language #250

Closed iStorry closed 10 months ago

iStorry commented 10 months ago

When ever i change the language it crashes the application. I can't tell weather it's MDX issue or next-international

image

I've created the repo with basic fresh project. Please check

https://github.com/iStorry/mdx-next-international-test

petyosi commented 10 months ago

mdxeditor author here, I traced down the problem in the editor to this piece in my code (lives in useEffect):

    document.body.appendChild(popupContainer)
    editorRootElementRef.current = popupContainer
    setEditorRootElementRef(editorRootElementRef)
    return () => {
      document.body.removeChild(popupContainer)
    }

Apparently, by the time the editor is unmounted, the popup container is no longer a direct child of the body element. I find this weird.

This is the fix: https://github.com/mdx-editor/editor/commit/5de52ad2c12eebdfe39f3ddb0f3ae13b857d7243. However, this might cause issues with other libraries who manage popups by moving them to the body.

iStorry commented 10 months ago

@petyosi Thank you for the quick response.

QuiiBz commented 10 months ago

Thanks for the quick fix!