Skip to content

rje-code-widgets: Cannot read properties of null (reading 'config') #5

@fschindler

Description

@fschindler

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions