Skip to content

Commit

Permalink
Remove unnecessary selectedClientIds prop in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Copons authored and ntsekouras committed May 20, 2021
1 parent ef1b5fa commit 757f20b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
3 changes: 0 additions & 3 deletions packages/block-editor/src/components/block-navigation/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const noop = () => {};
* @param {Object} props Components props.
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
* @param {Function} props.onSelect Block selection callback.
* @param {Array} props.selectedBlockClientIds The client IDs of the (single or multi-) selected blocks.
* @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks.
* @param {boolean} props.showOnlyCurrentHierarchy Flag to limit the list to the current hierarchy of blocks.
* @param {boolean} props.__experimentalFeatures Flag to enable experimental features.
Expand All @@ -36,15 +35,13 @@ export default function BlockNavigationTree( {
blocks,
showOnlyCurrentHierarchy,
onSelect = noop,
selectedBlockClientIds,
__experimentalFeatures,
__experimentalPersistentListViewFeatures,
...props
} ) {
const { clientIdsTree, selectedClientIds } = useBlockNavigationClientIds(
blocks,
showOnlyCurrentHierarchy,
selectedBlockClientIds,
__experimentalPersistentListViewFeatures
);
const { selectBlock } = useDispatch( blockEditorStore );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { isClientIdSelected } from './utils';
import { store as blockEditorStore } from '../../store';

const useBlockNavigationSelectedClientIds = (
selectedBlockClientIds,
__experimentalPersistentListViewFeatures
) =>
useSelect(
Expand All @@ -21,17 +20,13 @@ const useBlockNavigationSelectedClientIds = (
getSelectedBlockClientIds,
} = select( blockEditorStore );

if ( selectedBlockClientIds ) {
return selectedBlockClientIds;
}

if ( __experimentalPersistentListViewFeatures ) {
return getSelectedBlockClientIds();
}

return getSelectedBlockClientId();
},
[ selectedBlockClientIds, __experimentalPersistentListViewFeatures ]
[ __experimentalPersistentListViewFeatures ]
);

const useBlockNavigationClientIdsTree = (
Expand Down Expand Up @@ -79,11 +74,9 @@ const useBlockNavigationClientIdsTree = (
export default function useBlockNavigationClientIds(
blocks,
showOnlyCurrentHierarchy,
selectedBlockClientIds,
__experimentalPersistentListViewFeatures
) {
const selectedClientIds = useBlockNavigationSelectedClientIds(
selectedBlockClientIds,
__experimentalPersistentListViewFeatures
);
const clientIdsTree = useBlockNavigationClientIdsTree(
Expand Down

0 comments on commit 757f20b

Please sign in to comment.