fix: Check node type above custom update function for node views (#2081)

This commit is contained in:
Jon Noronha 2021-10-25 00:52:34 -07:00 committed by GitHub
parent 45778b81dd
commit ddc9ca8d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,6 +114,10 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeV
this.renderer.updateProps(props) this.renderer.updateProps(props)
} }
if (node.type !== this.node.type) {
return false
}
if (typeof this.options.update === 'function') { if (typeof this.options.update === 'function') {
const oldNode = this.node const oldNode = this.node
const oldDecorations = this.decorations const oldDecorations = this.decorations
@ -130,10 +134,6 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeV
}) })
} }
if (node.type !== this.node.type) {
return false
}
if (node === this.node && this.decorations === decorations) { if (node === this.node && this.decorations === decorations) {
return true return true
} }