Skip to content

Commit

Permalink
Add condition to break the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Sep 19, 2024
1 parent 2084336 commit a783818
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ export const getContentLockingParent = createSelector(
( state, clientId ) => {
let current = clientId;
let result;
while ( ( current = state.blocks.parents.get( current ) ) ) {
while (
! result &&
( current = state.blocks.parents.get( current ) )
) {
if ( getTemplateLock( state, current ) === 'contentOnly' ) {
result = current;
}
Expand All @@ -506,7 +509,10 @@ export const getParentSectionBlock = createSelector(
( state, clientId ) => {
let current = clientId;
let result;
while ( ( current = state.blocks.parents.get( current ) ) ) {
while (
! result &&
( current = state.blocks.parents.get( current ) )
) {
if ( isSectionBlock( state, current ) ) {
result = current;
}
Expand Down

0 comments on commit a783818

Please sign in to comment.