Filter by Attribute: fix potential reading property of undefined error (#47699)

* Fix reading from undefined error in attribute-filter

* Add changelog
This commit is contained in:
Karol Manijak 2024-05-22 11:57:53 +02:00 committed by GitHub
parent 04c8941099
commit f55e25b009
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -130,7 +130,7 @@ const AttributeFilterBlock = ( {
resourceName: 'products/attributes/terms',
resourceValues: [ attributeObject?.id || 0 ],
shouldSelect: blockAttributes.attributeId > 0,
query: { orderby: attributeObject.orderby },
query: { orderby: attributeObject?.orderby || 'menu_order' },
} );
const { results: filteredCounts, isLoading: filteredCountsLoading } =

View File

@ -13,7 +13,7 @@ export interface AttributeObject {
id: number;
label: string;
name: string;
order: 'menu_order' | 'name' | 'name_num' | 'id';
orderby: 'menu_order' | 'name' | 'name_num' | 'id';
parent: number;
taxonomy: string;
type: string;

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Filter by Attribute: fix potential reading from undefined error