From 193bde0bd5d634fce10617dcda8dccfdac5aab56 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 8 Mar 2024 20:45:21 -0500 Subject: [PATCH] fix: matchesNode error in destroyed editor transaction --- app/editor/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/editor/index.tsx b/app/editor/index.tsx index ccd78d4a3..0154691fd 100644 --- a/app/editor/index.tsx +++ b/app/editor/index.tsx @@ -457,11 +457,14 @@ export class Editor extends React.PureComponent< state: this.createState(this.props.value), editable: () => !this.props.readOnly, nodeViews: this.nodeViews, - dispatchTransaction(transaction) { + dispatchTransaction(this: EditorView, transaction) { + if (this.isDestroyed) { + return; + } + // callback is bound to have the view instance as its this binding - const { state, transactions } = ( - this.state as EditorState - ).applyTransaction(transaction); + const { state, transactions } = + this.state.applyTransaction(transaction); this.updateState(state);