From 91272dde6f465acd159e9050202b627f81c8dd94 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Tue, 5 Mar 2024 11:09:36 +0700 Subject: [PATCH] [Experimental] Fix: regression introduced in #44757 that breaks the inspector settings of the new attribute filter block (#45276) Fix: regression introduced in #44757 that breaks the inspector settings of the new attribute filter block --- .../components/inspector-controls.tsx | 17 ++++++++--------- .../inner-blocks/attribute-filter/edit.tsx | 7 +------ plugins/woocommerce/changelog/followup-44757 | 4 ++++ 3 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 plugins/woocommerce/changelog/followup-44757 diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/components/inspector-controls.tsx b/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/components/inspector-controls.tsx index 9fbf58f3bde..d7ace3085e9 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/components/inspector-controls.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/components/inspector-controls.tsx @@ -18,17 +18,12 @@ import { * Internal dependencies */ import { AttributeSelectControls } from './attribute-select-controls'; -import { BlockAttributes } from '../types'; +import { EditProps } from '../types'; -export const Inspector = ( { - attributes, - setAttributeId, -}: { - attributes: BlockAttributes; - setAttributeId: ( id: unknown ) => void; -} ) => { +export const Inspector = ( { attributes, setAttributes }: EditProps ) => { const { attributeId, showCounts, queryType, displayStyle, selectType } = attributes; + return ( @@ -122,7 +117,11 @@ export const Inspector = ( { { + setAttributes( { + attributeId: id, + } ); + } } /> diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/edit.tsx index 1220ff155df..2be98d1ecdc 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/product-filter/inner-blocks/attribute-filter/edit.tsx @@ -241,18 +241,13 @@ const Edit = ( props: EditProps ) => { ); - const inspectorProps = { - ...props, - setAttributeId, - }; - return ( - + { displayStyle === 'dropdown' ? (