[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
This commit is contained in:
Tung Du 2024-03-05 11:09:36 +07:00 committed by GitHub
parent 6490682366
commit 91272dde6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 15 deletions

View File

@ -18,17 +18,12 @@ import {
* Internal dependencies * Internal dependencies
*/ */
import { AttributeSelectControls } from './attribute-select-controls'; import { AttributeSelectControls } from './attribute-select-controls';
import { BlockAttributes } from '../types'; import { EditProps } from '../types';
export const Inspector = ( { export const Inspector = ( { attributes, setAttributes }: EditProps ) => {
attributes,
setAttributeId,
}: {
attributes: BlockAttributes;
setAttributeId: ( id: unknown ) => void;
} ) => {
const { attributeId, showCounts, queryType, displayStyle, selectType } = const { attributeId, showCounts, queryType, displayStyle, selectType } =
attributes; attributes;
return ( return (
<InspectorControls key="inspector"> <InspectorControls key="inspector">
<PanelBody title={ __( 'Display Settings', 'woocommerce' ) }> <PanelBody title={ __( 'Display Settings', 'woocommerce' ) }>
@ -122,7 +117,11 @@ export const Inspector = ( {
<AttributeSelectControls <AttributeSelectControls
isCompact={ true } isCompact={ true }
attributeId={ attributeId } attributeId={ attributeId }
setAttributeId={ setAttributeId } setAttributeId={ ( id: number ) => {
setAttributes( {
attributeId: id,
} );
} }
/> />
</PanelBody> </PanelBody>
</InspectorControls> </InspectorControls>

View File

@ -241,18 +241,13 @@ const Edit = ( props: EditProps ) => {
</Wrapper> </Wrapper>
); );
const inspectorProps = {
...props,
setAttributeId,
};
return ( return (
<Wrapper <Wrapper
onClickToolbarEdit={ toggleEditing } onClickToolbarEdit={ toggleEditing }
isEditing={ isEditing } isEditing={ isEditing }
blockProps={ blockProps } blockProps={ blockProps }
> >
<Inspector { ...inspectorProps } /> <Inspector { ...props } />
<Disabled> <Disabled>
{ displayStyle === 'dropdown' ? ( { displayStyle === 'dropdown' ? (
<AttributeDropdown <AttributeDropdown

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Experimental: Fix: Regression introduced in #44757 that breaks the inspector setting of the new attribute filter block.