@@ -329,16 +329,13 @@ const withBlockTree =
329
329
// If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
330
330
const parentsOfRemovedBlocks = [ ] ;
331
331
for ( const clientId of action . clientIds ) {
332
+ const parentId = state . parents . get ( clientId ) ;
332
333
if (
333
- state . parents . get ( clientId ) !== undefined &&
334
- ( state . parents . get ( clientId ) === '' ||
335
- newState . byClientId . get (
336
- state . parents . get ( clientId )
337
- ) )
334
+ parentId !== undefined &&
335
+ ( parentId === '' ||
336
+ newState . byClientId . get ( parentId ) )
338
337
) {
339
- parentsOfRemovedBlocks . push (
340
- state . parents . get ( clientId )
341
- ) ;
338
+ parentsOfRemovedBlocks . push ( parentId ) ;
342
339
}
343
340
}
344
341
updateParentInnerBlocksInTree (
@@ -351,16 +348,13 @@ const withBlockTree =
351
348
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN' :
352
349
const parentsOfRemovedBlocks = [ ] ;
353
350
for ( const clientId of action . clientIds ) {
351
+ const parentId = state . parents . get ( clientId ) ;
354
352
if (
355
- state . parents . get ( clientId ) !== undefined &&
356
- ( state . parents . get ( clientId ) === '' ||
357
- newState . byClientId . get (
358
- state . parents . get ( clientId )
359
- ) )
353
+ parentId !== undefined &&
354
+ ( parentId === '' ||
355
+ newState . byClientId . get ( parentId ) )
360
356
) {
361
- parentsOfRemovedBlocks . push (
362
- state . parents . get ( clientId )
363
- ) ;
357
+ parentsOfRemovedBlocks . push ( parentId ) ;
364
358
}
365
359
}
366
360
newState . tree = new Map ( newState . tree ) ;
0 commit comments