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

Duplicated editor after show and hide the component using react 18 #306

Closed
michalstrzelecki opened this issue May 4, 2022 · 9 comments
Closed
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it. squad:devops Issue to be handled by the Devops team. type:bug

Comments

@michalstrzelecki
Copy link

obraz
If component is hidden (not in the dom, not rendered) and shown again then it will render twice.

@zengdukan
Copy link

zengdukan commented May 5, 2022

I have the same issue by getting-start, also with react 18.

@iliapir2
Copy link

iliapir2 commented May 5, 2022

I'm having the same issue as well! React 18 + Strict Mode.

@zengdukan
Copy link

zengdukan commented May 6, 2022

I find the issue missing after delete <React.StrictMode>, I guess ckeditor5-react not use for React 18's StrickMode

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  // <React.StrictMode>
    <App />
  // </React.StrictMode>
);

@iliapir2
Copy link

iliapir2 commented May 6, 2022

But for some reason older versions of react worked with Ckedtior even with strict mode

@pomek pomek added type:bug squad:devops Issue to be handled by the Devops team. labels May 11, 2022
@pomek
Copy link
Member

pomek commented May 11, 2022

Hey guys,

Thanks for reporting the issue. We're currently focused on other topics. Hence it's hard to say when we will fix the problem. I don't want to promise anything, but we will try to take a look at that in the next week.

However, we will appreciate if you could share steps that allow reproducing the problem,

@FilipTokarski
Copy link
Member

I can confirm this, the steps I followed:

  • create new app with npx create-react-app
  • install ckeditor component npm install --save @ckeditor/ckeditor5-react
  • create editor build in online builder, unzip and move to the project folder
  • add ckeditor as a dependency with yarn add file:./ckeditor5
  • update component's code like in the docs
  • run npm run start

Result - there are two editors on the page.

@dev-ankitkumar
Copy link

this is a react 18 bug when we use <React.StrictMode> it render twice componenents and when we remove <React.strictMode it work fine

@michalstrzelecki
Copy link
Author

yeak, but it should destroy the instance / unmount after component is not visible

@pomek
Copy link
Member

pomek commented May 18, 2022

I close this issue as DUP of #294. We fixed the issue and it should not occur in the latest version of the <CKEDitor> React component => https://github.com/ckeditor/ckeditor5-react/releases/tag/v5.0.1.

@pomek pomek closed this as completed May 18, 2022
@pomek pomek added the resolution:duplicate This issue is a duplicate of another issue and was merged into it. label May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it. squad:devops Issue to be handled by the Devops team. type:bug
Projects
None yet
Development

No branches or pull requests

6 participants