From 43af839298fdaf722b4b4d45704e19e13e5d3f80 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:33:32 -0800 Subject: [PATCH] Cherry pick 52432 into release/9.4 (#52538) * [WordPress 6.7] Make sure Product Image Gallery renders placeholder in Editor (#52432) * Render placeholder of Product Image Gallery every time * Add changelog * Fix lint * Prep for cherry pick 52432 --------- Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com> Co-authored-by: WooCommerce Bot --- .../product-image-gallery/edit.tsx | 33 +++++-------------- plugins/woocommerce/readme.txt | 1 + 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/product-image-gallery/edit.tsx b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/product-image-gallery/edit.tsx index b4f50c9ca6a..d4c8cf72db9 100644 --- a/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/product-image-gallery/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/atomic/blocks/product-elements/product-image-gallery/edit.tsx @@ -2,11 +2,8 @@ * External dependencies */ import { WC_BLOCKS_IMAGE_URL } from '@woocommerce/block-settings'; -import { isEmptyObject } from '@woocommerce/types'; import { useBlockProps } from '@wordpress/block-editor'; -import { BlockAttributes } from '@wordpress/blocks'; import { Disabled } from '@wordpress/components'; -import type { BlockEditProps } from '@wordpress/blocks'; /** * Internal dependencies @@ -35,30 +32,16 @@ const Placeholder = () => { ); }; -type Context = { - postId: string; - postType: string; - queryId: string; -}; - -interface Props extends BlockEditProps< BlockAttributes > { - context: Context; -} - -const Edit = ( { context }: Props ) => { +const Edit = () => { const blockProps = useBlockProps(); - if ( isEmptyObject( context ) ) { - return ( -
- - - -
- ); - } - // We have work on this case when we will work on the Single Product block. - return <>; + return ( +
+ + + +
+ ); }; export default Edit; diff --git a/plugins/woocommerce/readme.txt b/plugins/woocommerce/readme.txt index 2de0fb68e14..5baa073b463 100644 --- a/plugins/woocommerce/readme.txt +++ b/plugins/woocommerce/readme.txt @@ -173,6 +173,7 @@ WooCommerce comes with some sample data you can use to see how products look; im **WooCommerce** +* Fix - Product Image Gallery: Render placeholder in Editor in WordPress 6.7 [#52432](https://github.com/woocommerce/woocommerce/pull/52432) * Fix - Support situations in which (WooCommerce) translations are inadvertently loaded too early. [#52199](https://github.com/woocommerce/woocommerce/pull/52199) * Fix - Add a retry mechanism to the query to obtain the SKU lock for product creation through the API. [#51735](https://github.com/woocommerce/woocommerce/pull/51735) * Fix - Fix `Error: Failed opening required '.../wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AI/ProductsSchema.php` fatal error [#51912](https://github.com/woocommerce/woocommerce/pull/51912)