From d99d32a718f25724dfc4530e1cf11db305bffed6 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:34:39 +0300 Subject: [PATCH] Lodash: Remove _.isEmpty() from Fill props (#51096) --- .../block-editor/src/components/block-controls/fill.js | 10 ++++------ .../src/components/inspector-controls/fill.js | 8 ++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/block-editor/src/components/block-controls/fill.js b/packages/block-editor/src/components/block-controls/fill.js index 73c6a4c8c912f4..0c7464449c72d6 100644 --- a/packages/block-editor/src/components/block-controls/fill.js +++ b/packages/block-editor/src/components/block-controls/fill.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty } from 'lodash'; - /** * WordPress dependencies */ @@ -38,7 +33,10 @@ export default function BlockControlsFill( { // Children passed to BlockControlsFill will not have access to any // React Context whose Provider is part of the BlockControlsSlot tree. // So we re-create the Provider in this subtree. - const value = ! isEmpty( fillProps ) ? fillProps : null; + const value = + fillProps && Object.keys( fillProps ).length > 0 + ? fillProps + : null; return ( { group === 'default' && ( diff --git a/packages/block-editor/src/components/inspector-controls/fill.js b/packages/block-editor/src/components/inspector-controls/fill.js index d33691c9b704aa..2db809a46b21e9 100644 --- a/packages/block-editor/src/components/inspector-controls/fill.js +++ b/packages/block-editor/src/components/inspector-controls/fill.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty } from 'lodash'; - /** * WordPress dependencies */ @@ -82,7 +77,8 @@ function ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) { // access to any React Context whose Provider is part of // the InspectorControlsSlot tree. So we re-create the // Provider in this subtree. - const value = ! isEmpty( fillProps ) ? fillProps : null; + const value = + fillProps && Object.keys( fillProps ).length > 0 ? fillProps : null; return ( { children }