Skip to content

Commit

Permalink
useBlockControlsFill: avoid unneeded store subscriptions (#55340)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr authored Oct 13, 2023
1 parent 8c04020 commit e21581b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/block-editor/src/components/block-controls/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ export default function useBlockControlsFill( group, shareWithChildBlocks ) {
const { clientId } = useBlockEditContext();
const isParentDisplayed = useSelect(
( select ) => {
if ( ! shareWithChildBlocks ) {
return false;
}

const { getBlockName, hasSelectedInnerBlock } =
select( blockEditorStore );
const { hasBlockSupport } = select( blocksStore );

return (
shareWithChildBlocks &&
hasBlockSupport(
getBlockName( clientId ),
'__experimentalExposeControlsToChildren',
false
) &&
hasSelectedInnerBlock( clientId )
) && hasSelectedInnerBlock( clientId )
);
},
[ shareWithChildBlocks, clientId ]
Expand Down

1 comment on commit e21581b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in e21581b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6507484362
📝 Reported issues:

Please sign in to comment.