CYS - Core: fix Product Rating block renders (#45600)

* CYS - Core: fix Product Rating block renders

* add comment

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-03-15 18:01:56 +01:00 committed by GitHub
parent e5d33df9ab
commit 25c804ae7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -16,6 +16,8 @@ import { useQuery } from '@woocommerce/navigation';
// @ts-expect-error No types for this exist yet.
import useSiteEditorSettings from '@wordpress/edit-site/build-module/components/block-editor/use-site-editor-settings';
import { useCallback, useContext, useMemo } from '@wordpress/element';
// @ts-expect-error No types for this exist yet.
import { store as editSiteStore } from '@wordpress/edit-site/build-module/store';
/**
* Internal dependencies
@ -78,8 +80,18 @@ export const BlockEditorContainer = () => {
[]
);
// This is necessary to avoid this issue: https://github.com/woocommerce/woocommerce/issues/45593
// Related PR: https://github.com/woocommerce/woocommerce/pull/45600
const { templateType } = useSelect( ( select ) => {
const { getEditedPostType } = unlock( select( editSiteStore ) );
return {
templateType: getEditedPostType(),
};
}, [] );
const [ blocks, , onChange ] = useEditorBlocks(
'wp_template',
templateType,
currentTemplate?.id ?? ''
);

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
CYS - Core: fix Product Rating block renders