Add temporary workaround to fix inserting Cart block in WordPress.com (https://github.com/woocommerce/woocommerce-blocks/pull/7367)
* remove problematic actions as deps * add inline docs * add todo comment
This commit is contained in:
parent
e9f38ee5af
commit
6b00017b12
|
@ -67,7 +67,9 @@ export const useForcedLayout = ( {
|
||||||
insertBlock( newBlock, position, clientId, false );
|
insertBlock( newBlock, position, clientId, false );
|
||||||
setForcedBlocksInserted( forcedBlocksInserted + 1 );
|
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(
|
const lockedBlockTypes = useMemo(
|
||||||
|
@ -144,11 +146,10 @@ export const useForcedLayout = ( {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}, [
|
/*
|
||||||
clientId,
|
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.
|
||||||
innerBlocks,
|
@todo Add replaceInnerBlocks and insertBlock after fixing https://github.com/Automattic/wp-calypso/issues/66092
|
||||||
lockedBlockTypes,
|
*/
|
||||||
replaceInnerBlocks,
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
appendBlock,
|
}, [ clientId, innerBlocks, lockedBlockTypes, appendBlock ] );
|
||||||
] );
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue