This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
assets/js/blocks/mini-cart Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ import { getSetting } from '@woocommerce/settings';
1515import { __ } from '@wordpress/i18n' ;
1616import Noninteractive from '@woocommerce/base-components/noninteractive' ;
1717import type { ReactElement } from 'react' ;
18- import { useSelect } from '@wordpress/data' ;
1918
2019/**
2120 * Internal dependencies
@@ -34,14 +33,18 @@ interface Props {
3433 setAttributes : ( attributes : Record < string , unknown > ) => void ;
3534}
3635
37- const Edit = ( { attributes, setAttributes } : Props ) : ReactElement => {
36+ const Edit = ( {
37+ attributes,
38+ setAttributes,
39+ context : { postType, postId } ,
40+ } : Props ) : ReactElement => {
3841 const { addToCartBehaviour, hasHiddenPrice, cartAndCheckoutRenderStyle } =
3942 attributes ;
4043 const blockProps = useBlockProps ( {
4144 className : `wc-block-mini-cart` ,
4245 } ) ;
4346
44- const isSiteEditor = useSelect ( 'core/edit-site' ) ! == undefined ;
47+ const isSiteEditor = postType === undefined || postId = == undefined ;
4548
4649 const templatePartEditUri = getSetting (
4750 'templatePartEditUri' ,
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ const settings: BlockConfiguration = {
4848 className : 'wc-block-mini-cart--preview' ,
4949 } ,
5050 } ,
51+ usesContext : [ 'postId' , 'postType' ] ,
5152 attributes : {
5253 isPreview : {
5354 type : 'boolean' ,
You can’t perform that action at this time.
0 commit comments