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

Commit 4d96283

Browse files
github-actions[bot]github-actionsAljullualbaringigitux
authored
Release: 8.9.2 (#7803)
* Empty commit for release pull request * Display correct block template when filtering by attribute (#7640) * Fix error when trying to access the queried object when it's null (#7664) * Fix error when trying to access the queried object when it's null. * Check if the `slug` exists * Use the taxonomy name instead of the slug, otherwise it returns false * Update readme changelog * Add testing notes * Improve testing notes format * Bumping version strings to new version. * Prevent Mini Cart loading the same script twice (#7794) * Empty commit for release pull request * update changelog * add testing instructions * update zip file link * Mini Cart: load wc-blocks-registry package at the load of the page instead of lazy load it (#7813) * update changelog * update testing instructions * update zip file link * Bumping version strings to new version. Co-authored-by: github-actions <[email protected]> Co-authored-by: Albert Juhé Lluveras <[email protected]> Co-authored-by: Alba Rincón <[email protected]> Co-authored-by: Alba Rincón <[email protected]> Co-authored-by: Luigi <[email protected]>
1 parent 0bbc654 commit 4d96283

File tree

9 files changed

+50
-13
lines changed

9 files changed

+50
-13
lines changed

assets/js/base/utils/lazy-load-script.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ interface AppendScriptAttributesParam {
2626
* This function checks whether an element matching that selector exists.
2727
* Useful to know if a script has already been appended to the page.
2828
*/
29-
const isScriptTagInDOM = ( scriptId: string ): boolean => {
30-
const scriptElements = document.querySelectorAll( `script#${ scriptId }` );
29+
const isScriptTagInDOM = ( scriptId: string, src = '' ): boolean => {
30+
const srcParts = src.split( '?' );
31+
if ( srcParts?.length > 1 ) {
32+
src = srcParts[ 0 ];
33+
}
34+
const selector = src
35+
? `script#${ scriptId }, script[src*="${ src }"]`
36+
: `script#${ scriptId }`;
37+
const scriptElements = document.querySelectorAll( selector );
38+
3139
return scriptElements.length > 0;
3240
};
3341

@@ -37,7 +45,10 @@ const isScriptTagInDOM = ( scriptId: string ): boolean => {
3745
*/
3846
const appendScript = ( attributes: AppendScriptAttributesParam ): void => {
3947
// Abort if id is not valid or a script with the same id exists.
40-
if ( ! isString( attributes.id ) || isScriptTagInDOM( attributes.id ) ) {
48+
if (
49+
! isString( attributes.id ) ||
50+
isScriptTagInDOM( attributes.id, attributes?.src )
51+
) {
4152
return;
4253
}
4354
const scriptElement = document.createElement( 'script' );
@@ -92,7 +103,7 @@ const lazyLoadScript = ( {
92103
translations,
93104
}: LazyLoadScriptParams ): Promise< void > => {
94105
return new Promise( ( resolve, reject ) => {
95-
if ( isScriptTagInDOM( `${ handle }-js` ) ) {
106+
if ( isScriptTagInDOM( `${ handle }-js`, src ) ) {
96107
resolve();
97108
}
98109

assets/js/base/utils/preload-script.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ const preloadScript = ( {
1313
src,
1414
version,
1515
}: PreloadScriptParams ): void => {
16-
const handleScriptElements = document.querySelectorAll(
17-
`#${ handle }-js, #${ handle }-js-prefetch`
18-
);
16+
const srcParts = src.split( '?' );
17+
if ( srcParts?.length > 1 ) {
18+
src = srcParts[ 0 ];
19+
}
20+
const selector = `#${ handle }-js, #${ handle }-js-prefetch, script[src*="${ src }"]`;
21+
const handleScriptElements = document.querySelectorAll( selector );
1922

2023
if ( handleScriptElements.length === 0 ) {
2124
const prefetchLink = document.createElement( 'link' );
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Testing notes and ZIP for release 8.9.2
2+
3+
Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-blocks/files/10134811/woocommerce-gutenberg-products-block.zip)
4+
5+
## Feature plugin and package inclusion in WooCommerce
6+
7+
### Mini Cart block: fix compatibility with Page Optimize and Product Bundles plugins [#7794](https://github.com/woocommerce/woocommerce-blocks/pull/7794) [#7813](https://github.com/woocommerce/woocommerce-blocks/pull/7813)
8+
9+
1. Install [Page Optimize](https://wordpress.org/plugins/page-optimize/) and [Product Bundles](https://woocommerce.com/products/product-bundles/).
10+
2. Enable a block theme.
11+
3. Customize the block theme and add the Mini Cart block in the header via Site Editor.
12+
4. Save the changes.
13+
5. In the frontend, lick on the Mini Cart. The drawer should open and show the "empty cart" message.
14+
6. Go to the shop page and add a product to your cart.
15+
7. Click on the Mini Cart. The drawer should open and show the product you just added.

docs/internal-developers/testing/releases/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Every release includes specific testing instructions for new features and bug fi
103103
- [8.8.2](./882.md)
104104
- [8.9.0](./890.md)
105105
- [8.9.1](./891.md)
106+
- [8.9.2](./892.md)
106107

107108
<!-- FEEDBACK -->
108109

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@woocommerce/block-library",
33
"title": "WooCommerce Blocks",
44
"author": "Automattic",
5-
"version": "8.9.1",
5+
"version": "8.9.2",
66
"description": "WooCommerce blocks for the Gutenberg editor.",
77
"homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/",
88
"keywords": [

readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks
44
Requires at least: 6.1
55
Tested up to: 6.1
66
Requires PHP: 7.0
7-
Stable tag: 8.9.1
7+
Stable tag: 8.9.2
88
License: GPLv3
99
License URI: https://www.gnu.org/licenses/gpl-3.0.html
1010

@@ -79,6 +79,13 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/
7979

8080
== Changelog ==
8181

82+
= 8.9.2 - 2022-12-01
83+
84+
#### Bug Fixes
85+
86+
- Mini Cart block: fix compatibility with Page Optimize and Product Bundles plugins [#7794](https://github.com/woocommerce/woocommerce-blocks/pull/7794)
87+
- Mini Cart block: Load wc-blocks-registry package at the page's load instead of lazy load it [#7813](https://github.com/woocommerce/woocommerce-blocks/pull/7813)
88+
8289
= 8.9.1 - 2022-11-14 =
8390

8491
#### Bug fixes

src/BlockTypes/MiniCart.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function get_block_type_script( $key = null ) {
103103
$script = [
104104
'handle' => 'wc-' . $this->block_name . '-block-frontend',
105105
'path' => $this->asset_api->get_block_asset_build_path( $this->block_name . '-frontend' ),
106-
'dependencies' => [],
106+
'dependencies' => [ 'wc-blocks-registry' ],
107107
];
108108
return $key ? $script[ $key ] : $script;
109109
}
@@ -273,7 +273,7 @@ protected function append_script_and_deps_src( $script ) {
273273
}
274274
}
275275
}
276-
if ( ! $script->src ) {
276+
if ( ! $script->src || 'wc-blocks-registry' === $script->handle ) {
277277
return;
278278
}
279279

src/Package.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static function container( $reset = false ) {
109109
NewPackage::class,
110110
function ( $container ) {
111111
// leave for automated version bumping.
112-
$version = '8.9.1';
112+
$version = '8.9.2';
113113
return new NewPackage(
114114
$version,
115115
dirname( __DIR__ ),

woocommerce-gutenberg-products-block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WooCommerce Blocks
44
* Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
55
* Description: WooCommerce blocks for the Gutenberg editor.
6-
* Version: 8.9.1
6+
* Version: 8.9.2
77
* Author: Automattic
88
* Author URI: https://woocommerce.com
99
* Text Domain: woo-gutenberg-products-block

0 commit comments

Comments
 (0)