I’m having an issue with async uploading of images, mostly based on the ProseMirror upload example.
If for any reason the view is destroyed before the Promise is resolved, then I get an error:
index.js:4928 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'matchesNode')
at EditorView.updateStateInner (index.js:4928)
at EditorView.updateState (index.js:4899)
at EditorView.dispatchTransaction (editor.cljs:286)
at EditorView.dispatch (index.js:5176)
at eval (placeholder.js:61)
I can’t find an official API to detect whether the view is destroyed so I can bail out of doing anything there. I could check for view.docView
since it seems to be set to null
when destroyed but would prefer an official API.