Fix filter count display toggle (https://github.com/woocommerce/woocommerce-blocks/pull/10096)
* fix save method * improve check * Only display counts if showCounts is true --------- Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
This commit is contained in:
parent
6b8e4c38e0
commit
7ca65db5b0
|
@ -49,12 +49,7 @@ registerBlockType( metadata, {
|
|||
{ ...useBlockProps.save( {
|
||||
className: classNames( 'is-loading', className ),
|
||||
} ) }
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className="wc-block-product-attribute-filter__placeholder"
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
);
|
||||
},
|
||||
deprecated,
|
||||
|
|
|
@ -127,7 +127,7 @@ export const parseAttributes = ( data: Record< string, unknown > ) => {
|
|||
isString( data?.attributeId ) ? data.attributeId : '0',
|
||||
10
|
||||
),
|
||||
showCounts: data?.showCounts !== 'false',
|
||||
showCounts: data?.showCounts === 'true',
|
||||
queryType:
|
||||
( isString( data?.queryType ) && data.queryType ) ||
|
||||
metadata.attributes.queryType.default,
|
||||
|
|
|
@ -36,12 +36,7 @@ registerBlockType( metadata, {
|
|||
{ ...useBlockProps.save( {
|
||||
className: classNames( 'is-loading', className ),
|
||||
} ) }
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className="wc-block-product-rating-filter__placeholder"
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
);
|
||||
},
|
||||
deprecated,
|
||||
|
|
|
@ -38,7 +38,7 @@ export const formatSlug = ( slug: string ) =>
|
|||
export const parseAttributes = ( data: Record< string, unknown > ) => {
|
||||
return {
|
||||
showFilterButton: data?.showFilterButton === 'true',
|
||||
showCounts: data?.showCounts !== 'false',
|
||||
showCounts: data?.showCounts === 'true',
|
||||
isPreview: false,
|
||||
displayStyle:
|
||||
( isString( data?.displayStyle ) && data.displayStyle ) ||
|
||||
|
|
|
@ -38,12 +38,7 @@ registerBlockType( metadata, {
|
|||
{ ...useBlockProps.save( {
|
||||
className: classNames( 'is-loading', className ),
|
||||
} ) }
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className="wc-block-product-stock-filter__placeholder"
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
);
|
||||
},
|
||||
deprecated,
|
||||
|
|
|
@ -48,7 +48,7 @@ export const parseAttributes = ( data: Record< string, unknown > ) => {
|
|||
parseInt( data.headingLevel, 10 ) ) ||
|
||||
metadata.attributes.headingLevel.default,
|
||||
showFilterButton: data?.showFilterButton === 'true',
|
||||
showCounts: data?.showCounts !== 'false',
|
||||
showCounts: data?.showCounts === 'true',
|
||||
isPreview: false,
|
||||
displayStyle:
|
||||
( isString( data?.displayStyle ) && data.displayStyle ) ||
|
||||
|
|
Loading…
Reference in New Issue