Hi Sacha,
I think I've stumbled upon a bug in the rje-code-widgets, which is caused by the new destroy() feature in the HeadlessEditor introduced in v0.36.
In the useEditor hook we call the HeadlessEditor.destroy() function, which, among other things, sets the instance variable HeadlessEditor::draft to null.
In the rje-code-widgets package, however, we access editor.draft.config in the jsonSchemaLinter() function, for example.
I assume that we're getting a Cannot read properties of null (reading 'config') because the hook (useEffect) and the rendering of the widget run asynchronously in the render loop and the rendering of the widget is obviously still accessing an editor instance that has already been destroyed.
Can you confirm this line of thought?
Hi Sacha,
I think I've stumbled upon a bug in the
rje-code-widgets, which is caused by the newdestroy()feature in theHeadlessEditorintroduced in v0.36.In the
useEditorhook we call theHeadlessEditor.destroy()function, which, among other things, sets the instance variableHeadlessEditor::drafttonull.In the
rje-code-widgetspackage, however, we accesseditor.draft.configin thejsonSchemaLinter()function, for example.I assume that we're getting a
Cannot read properties of null (reading 'config')because the hook (useEffect) and the rendering of the widget run asynchronously in the render loop and the rendering of the widget is obviously still accessing an editor instance that has already been destroyed.Can you confirm this line of thought?