fix(react): fix performance regression because of select/deselect (#4661)

This commit is contained in:
bdbch 2023-11-30 18:03:53 +01:00 committed by GitHub
parent b2e3b7e23f
commit ad7f659ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,8 +134,16 @@ class ReactNodeView extends NodeView<
const { from, to } = this.editor.state.selection const { from, to } = this.editor.state.selection
if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) { if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {
if (this.renderer.props.selected) {
return
}
this.selectNode() this.selectNode()
} else { } else {
if (!this.renderer.props.selected) {
return
}
this.deselectNode() this.deselectNode()
} }
} }