Skip to content

Commit

Permalink
Fix: regression introduced in #44757 that breaks the inspector settin…
Browse files Browse the repository at this point in the history
…gs of the new attribute filter block
  • Loading branch information
dinhtungdu committed Mar 4, 2024
1 parent e38ffc8 commit eb9dc63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
Expand Up @@ -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' ) }>
Expand Down Expand Up @@ -122,7 +117,11 @@ export const Inspector = ( {
<AttributeSelectControls
isCompact={ true }
attributeId={ attributeId }
setAttributeId={ setAttributeId }
setAttributeId={ ( id: number ) => {
setAttributes( {
attributeId: id,
} );
} }
/>
</PanelBody>
</InspectorControls>
Expand Down
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/followup-44757
@@ -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.

0 comments on commit eb9dc63

Please sign in to comment.