Skip to content

Commit

Permalink
fix: Check node type above custom update function for node views (#2081)
Browse files Browse the repository at this point in the history
  • Loading branch information
thatsjonsense authored Oct 25, 2021
1 parent 45778b8 commit ddc9ca8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/react/src/ReactNodeViewRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ class ReactNodeView extends NodeView<React.FunctionComponent, Editor, ReactNodeV
this.renderer.updateProps(props)
}

if (node.type !== this.node.type) {
return false
}

if (typeof this.options.update === 'function') {
const oldNode = this.node
const oldDecorations = this.decorations
Expand All @@ -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) {
return true
}
Expand Down

0 comments on commit ddc9ca8

Please sign in to comment.