From b67e5a5f101e3c2e5a2511be0d3405d886213b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Wed, 25 Mar 2020 12:19:24 +0100 Subject: [PATCH] Fix 'Show Sorting Dropdown' attribute ignored in All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/2019) * Fix 'Show Sorting Dropdown' attribute ignored in All Products block * Update snapshot --- .../assets/js/blocks/products/all-products/index.js | 11 +++++++---- .../backend/__snapshots__/all-products.test.js.snap | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/index.js b/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/index.js index 557d2ff6c4f..c027e28c7ba 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/index.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/products/all-products/index.js @@ -52,11 +52,14 @@ const blockSettings = { * @param {Object} attributes Attributes to save. */ save( { attributes } ) { + const dataAttributes = {}; + Object.keys( attributes ) + .sort() + .forEach( ( key ) => { + dataAttributes[ key ] = attributes[ key ]; + } ); const data = { - 'data-attributes': JSON.stringify( - attributes, - Object.keys( attributes ).sort() - ), + 'data-attributes': JSON.stringify( dataAttributes ), }; return (
-
+
" `; \ No newline at end of file