Skip to content

Commit

Permalink
Image Block: Improve performance by only requesting image metadata if…
Browse files Browse the repository at this point in the history
… selected. (#17504)
  • Loading branch information
epiqueras authored Sep 24, 2019
1 parent c48a9c8 commit aedd241
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ export default compose( [
withSelect( ( select, props ) => {
const { getMedia } = select( 'core' );
const { getSettings } = select( 'core/block-editor' );
const { id } = props.attributes;
const { attributes: { id }, isSelected } = props;
const {
__experimentalMediaUpload,
imageSizes,
Expand All @@ -948,7 +948,7 @@ export default compose( [
} = getSettings();

return {
image: id ? getMedia( id ) : null,
image: id && isSelected ? getMedia( id ) : null,
maxWidth,
isRTL,
imageSizes,
Expand Down

0 comments on commit aedd241

Please sign in to comment.