Skip to content

Commit

Permalink
Blocks: Avoid multiple calls to setAttributes in resetWidthHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Nov 20, 2018
1 parent e2f8007 commit bf67408
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,19 @@ class ImageEdit extends Component {
}

resetWidthHeight( fileWidth, fileHeight ) {
if ( fileWidth && fileHeight ) {
this.props.setAttributes( {
fileWidth,
fileHeight,
} );
}

this.props.setAttributes( {
const nextAttributes = {
width: undefined,
height: undefined,
userSetDimensions: undefined,
editWidth: __unstableDOM.getBlockWidth(),
} );
};

if ( fileWidth && fileHeight ) {
nextAttributes.fileWidth = fileWidth;
nextAttributes.fileHeight = fileHeight;
}

this.props.setAttributes( nextAttributes );
}

/**
Expand Down

0 comments on commit bf67408

Please sign in to comment.