Skip to content

Commit

Permalink
Lodash: Remove _.isEmpty() from Fill props (#51096)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Jun 1, 2023
1 parent 621c282 commit f907d0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 4 additions & 6 deletions packages/block-editor/src/components/block-controls/fill.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import { isEmpty } from 'lodash';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -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 (
<ToolbarContext.Provider value={ value }>
{ group === 'default' && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import { isEmpty } from 'lodash';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -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 (
<ToolsPanelContext.Provider value={ value }>
{ children }
Expand Down

0 comments on commit f907d0f

Please sign in to comment.