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

Quick rerendering causes editor issues #471

Closed
DawidKossowski opened this issue Apr 18, 2024 · 2 comments
Closed

Quick rerendering causes editor issues #471

DawidKossowski opened this issue Apr 18, 2024 · 2 comments
Assignees
Labels
squad:collaboration Issue to be handled by the Collaboration team. type:bug
Milestone

Comments

@DawidKossowski
Copy link
Contributor

In StrictMode or in situations where the application quickly rerenders, the next editor instance is rerendered or attempts to rerender before the previous instance is destroyed, especially when the editor uses async calls (for example, for getting the cloud services token).

We've implemented a mechanism to keep track of the destroying promise (editorDestructionInProgress) and to wait for it to resolve before initializing the next editor instance. However, in some cases, the next editor instance is initialized before the previous one starts the destroying process (editorDestructionInProgress is null). This results in two editor instances on the page or in an error: CKEditorError: editor-source-element-already-used. The outcome depends on the integration.

This issue is non-deterministic and depends on the React versions, but it can be reproduced by adding the config with cloudServices property (in our demo: demo-react-18) to trigger a request for a token during editor initialization.

@DawidKossowski DawidKossowski added type:bug squad:collaboration Issue to be handled by the Collaboration team. labels Apr 18, 2024
@DawidKossowski
Copy link
Contributor Author

@Mati365 please check this mechanism in both integrations: CKEditor and useMultiRootEditor.

DawidKossowski pushed a commit that referenced this issue May 9, 2024
Fix: The quick rerendering, especially in `React.StrictMode`, will no longer cause the editor errors. Closes #442, #469, #471, #476.
@Mati365
Copy link
Member

Mati365 commented Jun 6, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:collaboration Issue to be handled by the Collaboration team. type:bug
Projects
None yet
Development

No branches or pull requests

2 participants