Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,21 @@ export const __unstableGetClientIdsTree = createSelector(
*
* @return {Array} ids of descendants.
*/
export const getClientIdsOfDescendants = ( state, clientIds ) => {
const collectedIds = [];
for ( const givenId of clientIds ) {
for ( const descendantId of getBlockOrder( state, givenId ) ) {
collectedIds.push(
descendantId,
...getClientIdsOfDescendants( state, [ descendantId ] )
);
export const getClientIdsOfDescendants = createSelector(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have been memoized anyway, I don't think that's what caused the regression though but let's see.

( state, clientIds ) => {
const collectedIds = [];
for ( const givenId of clientIds ) {
for ( const descendantId of getBlockOrder( state, givenId ) ) {
collectedIds.push(
descendantId,
...getClientIdsOfDescendants( state, [ descendantId ] )
);
}
}
}
return collectedIds;
};
return collectedIds;
},
( state ) => [ state.blocks.order ]
);

/**
* Returns an array containing the clientIds of the top-level blocks and
Expand Down