Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 897e205

Browse files
authored
Revert "Fix useForcedLayout to re-select inner blocks after we manually insert one (#6676)" (#7447)
This reverts commit 1564de2.
1 parent d26befb commit 897e205

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

assets/js/blocks/cart-checkout-shared/use-forced-layout.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
useRef,
77
useCallback,
88
useMemo,
9-
useState,
109
} from '@wordpress/element';
1110
import { useSelect, useDispatch } from '@wordpress/data';
1211
import {
@@ -42,8 +41,6 @@ export const useForcedLayout = ( {
4241
} ): void => {
4342
const currentRegisteredBlocks = useRef( registeredBlocks );
4443
const currentDefaultTemplate = useRef( defaultTemplate );
45-
const [ forcedBlocksInserted, setForcedBlocksInserted ] =
46-
useState< number >( 0 );
4744

4845
const { insertBlock, replaceInnerBlocks } =
4946
useDispatch( 'core/block-editor' );
@@ -58,18 +55,17 @@ export const useForcedLayout = ( {
5855
),
5956
};
6057
},
61-
[ clientId, currentRegisteredBlocks.current, forcedBlocksInserted ]
58+
[ clientId, currentRegisteredBlocks.current ]
6259
);
6360

6461
const appendBlock = useCallback(
6562
( block, position ) => {
6663
const newBlock = createBlock( block.name );
6764
insertBlock( newBlock, position, clientId, false );
68-
setForcedBlocksInserted( forcedBlocksInserted + 1 );
6965
},
7066
// We need to skip insertBlock here due to a cache issue in wordpress.com that causes an inifinite loop, see https://github.com/Automattic/wp-calypso/issues/66092 for an expanded doc.
7167
// eslint-disable-next-line react-hooks/exhaustive-deps
72-
[ clientId, forcedBlocksInserted ]
68+
[ clientId ]
7369
);
7470

7571
const lockedBlockTypes = useMemo(

0 commit comments

Comments
 (0)