diff --git a/editor/components/rich-text/annotations/annotation.js b/editor/components/rich-text/annotations/annotation.js index 937c9cf6451af6..e9691ed70ab4b6 100644 --- a/editor/components/rich-text/annotations/annotation.js +++ b/editor/components/rich-text/annotations/annotation.js @@ -56,6 +56,7 @@ class Annotation extends Component { startNode = this.matchEditorXPath( startXPath ); endNode = this.matchEditorXPath( endXPath ); } catch ( e ) { + console.log( "Couldn't match XPath", e ); return; } @@ -94,11 +95,13 @@ class Annotation extends Component { } static getDerivedStateFromProps( props, state ) { - const isDirty = ! isEqual( props.annotation, state.prevAnnotation ); + if ( ! isEqual( props.annotation, state.prevAnnotation ) ) { + return { + isDirty: true, + }; + } - return { - isDirty, - }; + return {}; } render() {