ckeditor5-react icon indicating copy to clipboard operation
ckeditor5-react copied to clipboard

CKEditor: handle being torn down before initialization

Open kyrofa opened this issue 2 years ago • 6 comments

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.

kyrofa avatar Jun 02 '23 23:06 kyrofa

@pomek will your team take a look?

Witoso avatar Jun 07 '23 07:06 Witoso

FYI, I did sign the CLA, not sure why your system thinks I haven't.

Screenshot from 2023-08-17 10-14-56

Just in case you're waiting for that to review this, @pomek.

kyrofa avatar Aug 17 '23 17:08 kyrofa

@vokiel could you check if it's signed?

Witoso avatar Aug 18 '23 10:08 Witoso

Check, all good :heavy_check_mark:

vokiel avatar Aug 18 '23 10:08 vokiel

Any chance someone could take a look at this? @pomek, friendly ping.

kyrofa avatar Oct 12 '23 22:10 kyrofa

@Witoso / @kyrofa This PR can be closed. We fixed this issue here, released in 7.0.0 version.

Mati365 avatar Jul 05 '24 05:07 Mati365

Closing due to https://github.com/ckeditor/ckeditor5-react/pull/383#issuecomment-2210212439.

pomek avatar Aug 26 '24 10:08 pomek