ckeditor / ckeditor5-react

Official CKEditor 5 React component.
https://ckeditor.com/ckeditor-5
Other
426 stars 100 forks source link

Option to disable watchdog on <CKEditorContext> #409

Open jake-netflix opened 1 year ago

jake-netflix commented 1 year ago

Similar to #373, it would be great if we could disable watchdog on the <CKEditorContext> component, so that there's no context watchdog running.

As an example, watchdog was scanning 100k unique objects (over 400k references to those objects) and then generating errors, because some of those objects are a Proxy that handle get and throw if a key is unexpected. Since this happens during _create, it fails to initialize altogether.

(It does this when it calls getSubNodes) https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-watchdog/src/utils/getsubnodes.ts

As a workaround, I use this:

<CKEditorContext context={ContextWithoutWatchdog} ... > ... </CKEditorContext>

And this class:

export class ContextWithoutWatchdog extends Context {
  public _watchdogExcluded = true;
}
Witoso commented 1 year ago

@pomek is this something you could plan?

As an example, watchdog was scanning 100k unique objects (over 400k references to those objects) and then generating errors, because some of those objects are a Proxy that handle get and throw if a key is unexpected. Since this happens during _create, it fails to initialize altogether.

Interesting case, fyi @DawidKossowski as you were spending some time with Watchdog recently.