Skip to content

Commit

Permalink
Set formats state only if changed
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Apr 26, 2017
1 parent 3d98287 commit ea5a642
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions blocks/components/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import classnames from 'classnames';
import { last } from 'lodash';
import { last, isEqual } from 'lodash';
import { Parser as HtmlToReactParser } from 'html-to-react';
import { Fill } from 'react-slot-fill';

Expand Down Expand Up @@ -165,7 +165,9 @@ export default class Editable extends wp.element.Component {
return result;
}, {} );

this.setState( { formats } );
if ( ! isEqual( this.state.formats, formats ) ) {
this.setState( { formats } );
}
}

bindEditorNode( ref ) {
Expand Down

0 comments on commit ea5a642

Please sign in to comment.