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

Commit

Permalink
Add temporary workaround to fix inserting Cart block in WordPress.com (
Browse files Browse the repository at this point in the history
…#7367)

* remove problematic actions as deps

* add inline docs

* add todo comment
  • Loading branch information
senadir authored Oct 11, 2022
1 parent 1c71a3b commit a7e3916
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions assets/js/blocks/cart-checkout-shared/use-forced-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export const useForcedLayout = ( {
insertBlock( newBlock, position, clientId, false );
setForcedBlocksInserted( forcedBlocksInserted + 1 );
},
[ clientId, insertBlock, forcedBlocksInserted ]
// 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.
// eslint-disable-next-line react-hooks/exhaustive-deps
[ clientId, forcedBlocksInserted ]
);

const lockedBlockTypes = useMemo(
Expand Down Expand Up @@ -144,11 +146,10 @@ export const useForcedLayout = ( {
break;
}
} );
}, [
clientId,
innerBlocks,
lockedBlockTypes,
replaceInnerBlocks,
appendBlock,
] );
/*
We need to skip replaceInnerBlocks 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.
@todo Add replaceInnerBlocks and insertBlock after fixing https://github.com/Automattic/wp-calypso/issues/66092
*/
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ clientId, innerBlocks, lockedBlockTypes, appendBlock ] );
};

0 comments on commit a7e3916

Please sign in to comment.