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

Update Mini-Cart block logic to use isSiteEditorPage util #9501

Merged
merged 2 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions assets/js/blocks/mini-cart/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import {
import { getSetting } from '@woocommerce/settings';
import { __ } from '@wordpress/i18n';
import Noninteractive from '@woocommerce/base-components/noninteractive';
import { isSiteEditorPage } from '@woocommerce/utils';
import type { ReactElement } from 'react';
import { select } from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -33,18 +35,14 @@ interface Props {
setAttributes: ( attributes: Record< string, unknown > ) => void;
}

const Edit = ( {
attributes,
setAttributes,
context: { postType, postId },
}: Props ): ReactElement => {
const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
const { addToCartBehaviour, hasHiddenPrice, cartAndCheckoutRenderStyle } =
attributes;
const blockProps = useBlockProps( {
className: `wc-block-mini-cart`,
} );

const isSiteEditor = postType === undefined || postId === undefined;
const isSiteEditor = isSiteEditorPage( select( 'core/edit-site' ) );

const templatePartEditUri = getSetting(
'templatePartEditUri',
Expand Down
1 change: 0 additions & 1 deletion assets/js/blocks/mini-cart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const settings: BlockConfiguration = {
className: 'wc-block-mini-cart--preview',
},
},
usesContext: [ 'postId', 'postType' ],
attributes: {
isPreview: {
type: 'boolean',
Expand Down