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 24, 2018
1 parent 7079812 commit 3b5f11e
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 3b5f11e

Please sign in to comment.