Skip to content

Commit

Permalink
Replace __experimentalGetGlobalBlocksByName with stable getBlocksByNa…
Browse files Browse the repository at this point in the history
…me (woocommerce#51773)

* Replace __experimentalGetGlobalBlocksByName with stable getBlocksByName

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

---------

Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
roykho and github-actions authored Oct 2, 2024
1 parent 27fc8f5 commit 64df8a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,10 @@ const isInProductArchive = () => {
const isFirstBlockThatUsesPageContext = (
property: 'inherit' | 'filterable'
) => {
// We use experimental selector because it's been graduated as stable (`getBlocksByName`)
// in Gutenberg 17.6 (https://github.com/WordPress/gutenberg/pull/58156) and will be
// available in WordPress 6.5.
// Created issue for that: https://github.com/woocommerce/woocommerce/issues/44768.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet, natively.
const { __experimentalGetGlobalBlocksByName, getBlock } =
select( blockEditorStore );
const productCollectionBlockIDs = __experimentalGetGlobalBlocksByName(
const { getBlocksByName, getBlock } = select( blockEditorStore );
const productCollectionBlockIDs = getBlocksByName(
'woocommerce/product-collection'
) as string[];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Replace __experimentalGetGlobalBlocksByName with stable getBlocksByName for Product Collection block

0 comments on commit 64df8a2

Please sign in to comment.