Skip to content

Commit

Permalink
ListViewBlock: Combine 'useSelect' hooks (WordPress#55889)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Nov 6, 2023
1 parent f8025b9 commit c19c9d8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ function ListViewBlock( {
const blockTitle =
blockInformation?.name || blockInformation?.title || __( 'Untitled' );

const block = useSelect(
( select ) => select( blockEditorStore ).getBlock( clientId ),
[ clientId ]
);
const blockName = useSelect(
( select ) => select( blockEditorStore ).getBlockName( clientId ),
[ clientId ]
);
const blockEditingMode = useSelect(
( select ) =>
select( blockEditorStore ).getBlockEditingMode( clientId ),
const { block, blockName, blockEditingMode } = useSelect(
( select ) => {
const { getBlock, getBlockName, getBlockEditingMode } =
select( blockEditorStore );

return {
block: getBlock( clientId ),
blockName: getBlockName( clientId ),
blockEditingMode: getBlockEditingMode( clientId ),
};
},
[ clientId ]
);

Expand Down

0 comments on commit c19c9d8

Please sign in to comment.