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 <no-reply@woocommerce.com>
This commit is contained in:
github-actions[bot] 2024-11-04 10:33:32 -08:00 committed by GitHub
parent db8deb21a8
commit 43af839298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 25 deletions

View File

@ -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 (
<div { ...blockProps }>
<Disabled>
<Placeholder />
</Disabled>
</div>
);
}
// We have work on this case when we will work on the Single Product block.
return <></>;
return (
<div { ...blockProps }>
<Disabled>
<Placeholder />
</Disabled>
</div>
);
};
export default Edit;

View File

@ -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)