Skip to content

Commit

Permalink
Zoom Out: Replace deprecated selector (#63144)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
  • Loading branch information
3 people authored Jul 5, 2024
1 parent 938a513 commit 2c5f768
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ function ZoomOutModeInserters() {
sectionRootClientId,
insertionPoint,
setInserterIsOpened,
selectedSection,
hasSelection,
} = useSelect( ( select ) => {
const { getSettings, getBlockOrder } = select( blockEditorStore );
const { getSettings, getBlockOrder, getSelectionStart } =
select( blockEditorStore );
const { sectionRootClientId: root } = unlock( getSettings() );
// To do: move ZoomOutModeInserters to core/editor.
// Or we perhaps we should move the insertion point state to the
Expand All @@ -33,7 +34,7 @@ function ZoomOutModeInserters() {
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const editor = select( 'core/editor' );
return {
selectedSection: editor.getSelectedBlock(),
hasSelection: !! getSelectionStart().clientId,
blockOrder: getBlockOrder( root ),
insertionPoint: unlock( editor ).getInsertionPoint(),
sectionRootClientId: root,
Expand Down Expand Up @@ -63,7 +64,7 @@ function ZoomOutModeInserters() {
};
}, [] );

if ( ! isReady || ! selectedSection ) {
if ( ! isReady || ! hasSelection ) {
return null;
}

Expand Down

1 comment on commit 2c5f768

@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 2c5f768.
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/9805619807
📝 Reported issues:

Please sign in to comment.