Skip to content

Commit

Permalink
Fix dirty checking
Browse files Browse the repository at this point in the history
  • Loading branch information
atimmer committed Jul 5, 2018
1 parent 89860a4 commit 4b31c23
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions editor/components/rich-text/annotations/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 4b31c23

Please sign in to comment.