[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
*/
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 (
<InspectorControls key="inspector">
<PanelBody title={ __( 'Display Settings', 'woocommerce' ) }>
@ -122,7 +117,11 @@ export const Inspector = ( {
<AttributeSelectControls
isCompact={ true }
attributeId={ attributeId }
setAttributeId={ setAttributeId }
setAttributeId={ ( id: number ) => {
setAttributes( {
attributeId: id,
} );
} }
/>
</PanelBody>
</InspectorControls>

View File

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