Skip to content

Commit

Permalink
Block Editor: Reduce the 'isZoomOut' selector calls in the block tool…
Browse files Browse the repository at this point in the history
…bar (#67594)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: talldan <[email protected]>
  • Loading branch information
3 people authored Dec 5, 2024
1 parent e18605f commit e8a7463
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export function PrivateBlockToolbar( {
( id ) => getTemplateLock( id ) === 'contentOnly'
);

const _isZoomOut = isZoomOut();

return {
blockClientId: selectedBlockClientId,
blockClientIds: selectedBlockClientIds,
Expand All @@ -132,7 +134,7 @@ export function PrivateBlockToolbar( {
shouldShowVisualToolbar: isValid && isVisual,
toolbarKey: `${ selectedBlockClientId }${ parentClientId }`,
showParentSelector:
! isZoomOut() &&
! _isZoomOut &&
parentBlockType &&
getBlockEditingMode( parentClientId ) !== 'disabled' &&
hasBlockSupport(
Expand All @@ -144,11 +146,11 @@ export function PrivateBlockToolbar( {
isUsingBindings: _isUsingBindings,
hasParentPattern: _hasParentPattern,
hasContentOnlyLocking: _hasTemplateLock,
showShuffleButton: isZoomOut(),
showSlots: ! isZoomOut(),
showGroupButtons: ! isZoomOut(),
showLockButtons: ! isZoomOut(),
showSwitchSectionStyleButton: isZoomOut(),
showShuffleButton: _isZoomOut,
showSlots: ! _isZoomOut,
showGroupButtons: ! _isZoomOut,
showLockButtons: ! _isZoomOut,
showSwitchSectionStyleButton: _isZoomOut,
hasFixedToolbar: getSettings().hasFixedToolbar,
isNavigationMode: _isNavigationMode(),
};
Expand Down

1 comment on commit e8a7463

@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 e8a7463.
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/12173406529
📝 Reported issues:

Please sign in to comment.