Skip to content

Commit

Permalink
Remove memoization
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Sep 10, 2024
1 parent 7670049 commit 995c4ac
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,24 +492,23 @@ export const getContentLockingParent = createSelector(
]
);

export const isContentLockingParent = createSelector(
( state, clientId ) => {
const sectionRootClientId = getSectionRootClientId( state );
const sectionClientIds = getBlockOrder( state, sectionRootClientId );
return (
getBlockName( state, clientId ) === 'core/block' ||
getTemplateLock( state, clientId ) === 'contentOnly' ||
( isNavigationMode( state ) &&
sectionClientIds.includes( clientId ) )
);
},
( state ) => [
state.blocks.parents,
state.blockListSettings,
state.editorMode,
getSectionRootClientId( state ),
]
);
/**
* Retrieves the client ID is a content locking parent
*
* @param {Object} state Global application state.
* @param {Object} clientId Client Id of the block.
*
* @return {boolean} Whether the block is a content locking parent.
*/
export function isContentLockingParent( state, clientId ) {
const sectionRootClientId = getSectionRootClientId( state );
const sectionClientIds = getBlockOrder( state, sectionRootClientId );
return (
getBlockName( state, clientId ) === 'core/block' ||
getTemplateLock( state, clientId ) === 'contentOnly' ||
( isNavigationMode( state ) && sectionClientIds.includes( clientId ) )
);
}

/**
* Retrieves the client ID of the block that is content locked but is
Expand Down

0 comments on commit 995c4ac

Please sign in to comment.