* 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:
Luigi Teschio 2023-07-05 08:51:02 +02:00 committed by GitHub
parent 6b8e4c38e0
commit 7ca65db5b0
6 changed files with 6 additions and 21 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 ) ||

View File

@ -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,

View File

@ -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 ) ||