From c3ba4df53107de6a324bcc59527490fea423d8d7 Mon Sep 17 00:00:00 2001 From: lukewalczak Date: Mon, 1 Feb 2021 15:01:55 +0100 Subject: [PATCH] Return if layoutWidth is not defined --- .../block-editor/src/components/block-list/block.native.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/block-list/block.native.js b/packages/block-editor/src/components/block-list/block.native.js index 8af1339ab78b3a..c7dc27bd821e32 100644 --- a/packages/block-editor/src/components/block-list/block.native.js +++ b/packages/block-editor/src/components/block-list/block.native.js @@ -124,13 +124,12 @@ class BlockListBlock extends Component { getBlockWidth( { nativeEvent } ) { const { layout } = nativeEvent; const { blockWidth } = this.state; + const layoutWidth = Math.floor( layout.width ); - if ( ! blockWidth ) { + if ( ! blockWidth || ! layoutWidth ) { return; } - const layoutWidth = Math.floor( layout.width ); - if ( blockWidth !== layoutWidth ) { this.setState( { blockWidth: layoutWidth } ); }