ckeditor5-react
ckeditor5-react copied to clipboard
CKEditor: handle being torn down before initialization
It's easy, particularly in tests, to end up rendering the editor only to then quickly change a prop that causes it to no longer render. It's possible for this to happen quickly enough that _initializeEditor() hasn't finished running yet, thus ending up in _createEditor() with a null element. That ends up causing CKEditor itself to throw an exception, and ends up not defining the editor, which then makes the watchdog throw an exception. The latter error is not catchable in an error boundary due to its asynchronous nature.
Fix this by making _createEditor() a little more defensive: make sure we have an element before bothering to create an editor. If we don't have one, we know we're in the midst of a teardown, so create a dummy editor so the watchdog has something to destroy.
This might be related to #351, but I'm not certain.
@pomek will your team take a look?
FYI, I did sign the CLA, not sure why your system thinks I haven't.
Just in case you're waiting for that to review this, @pomek.
@vokiel could you check if it's signed?
Check, all good :heavy_check_mark:
Any chance someone could take a look at this? @pomek, friendly ping.
@Witoso / @kyrofa This PR can be closed. We fixed this issue here, released in 7.0.0 version.
Closing due to https://github.com/ckeditor/ckeditor5-react/pull/383#issuecomment-2210212439.