From a6997e145b40fb4b42f9dfc13f1c204259883ec7 Mon Sep 17 00:00:00 2001
From: Hritik Chaudhary <33057454+hritikchaudhary@users.noreply.github.com>
Date: Thu, 29 Jun 2023 17:56:06 +0530
Subject: [PATCH 1/3] Remove data attributes from being saved in html of All
products block
---
assets/js/blocks/products/all-products/save.js | 4 ----
1 file changed, 4 deletions(-)
diff --git a/assets/js/blocks/products/all-products/save.js b/assets/js/blocks/products/all-products/save.js
index 108ae322d63..1f34d34e192 100644
--- a/assets/js/blocks/products/all-products/save.js
+++ b/assets/js/blocks/products/all-products/save.js
@@ -15,16 +15,12 @@ export default function save( { attributes } ) {
.forEach( ( key ) => {
dataAttributes[ key ] = attributes[ key ];
} );
- const data = {
- 'data-attributes': JSON.stringify( dataAttributes ),
- };
return (
From c5d80667ed583c0a8689a58ef421a232cfa0e258 Mon Sep 17 00:00:00 2001
From: Hritik Chaudhary <33057454+hritikchaudhary@users.noreply.github.com>
Date: Tue, 1 Aug 2023 15:27:14 +0530
Subject: [PATCH 2/3] added old save in deprecated
---
.../products/all-products/deprecated.js | 27 ++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/assets/js/blocks/products/all-products/deprecated.js b/assets/js/blocks/products/all-products/deprecated.js
index 5a5aadbf684..f6563dc5ecb 100644
--- a/assets/js/blocks/products/all-products/deprecated.js
+++ b/assets/js/blocks/products/all-products/deprecated.js
@@ -33,4 +33,29 @@ const v1 = {
},
};
-export default [ v1 ];
+const v2 = {
+ save( { attributes } ) {
+ const dataAttributes = {};
+ Object.keys( attributes )
+ .sort()
+ .forEach( ( key ) => {
+ dataAttributes[ key ] = attributes[ key ];
+ } );
+ const data = {
+ 'data-attributes': JSON.stringify( dataAttributes ),
+ };
+ return (
+
+
+
+ );
+ },
+};
+
+export default [ v1, v2 ];
From 52fe5bf0308cb7dba503c21d45362846e80cb1ea Mon Sep 17 00:00:00 2001
From: Hritik Chaudhary <33057454+hritikchaudhary@users.noreply.github.com>
Date: Tue, 1 Aug 2023 20:37:43 +0530
Subject: [PATCH 3/3] Addressed review comments
---
assets/js/blocks/products/all-products/deprecated.js | 5 ++++-
assets/js/blocks/products/all-products/save.js | 6 ------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/assets/js/blocks/products/all-products/deprecated.js b/assets/js/blocks/products/all-products/deprecated.js
index f6563dc5ecb..48e118f3c60 100644
--- a/assets/js/blocks/products/all-products/deprecated.js
+++ b/assets/js/blocks/products/all-products/deprecated.js
@@ -34,6 +34,9 @@ const v1 = {
};
const v2 = {
+ attributes: Object.assign( {}, attributeDefinitions, {
+ rows: { type: 'number', default: 1 },
+ } ),
save( { attributes } ) {
const dataAttributes = {};
Object.keys( attributes )
@@ -58,4 +61,4 @@ const v2 = {
},
};
-export default [ v1, v2 ];
+export default [ v2, v1 ];
diff --git a/assets/js/blocks/products/all-products/save.js b/assets/js/blocks/products/all-products/save.js
index 1f34d34e192..6f620e64e97 100644
--- a/assets/js/blocks/products/all-products/save.js
+++ b/assets/js/blocks/products/all-products/save.js
@@ -9,12 +9,6 @@ import { InnerBlocks } from '@wordpress/block-editor';
import { getBlockClassName } from '../utils.js';
export default function save( { attributes } ) {
- const dataAttributes = {};
- Object.keys( attributes )
- .sort()
- .forEach( ( key ) => {
- dataAttributes[ key ] = attributes[ key ];
- } );
return (