Fix: In product list, if menu category is reset, all products get filtered out as it becomes undefined.

This commit is contained in:
2026-02-12 09:01:12 +00:00
parent 535a145742
commit ecc92795e6
2 changed files with 1 additions and 4 deletions

View File

@ -71,7 +71,7 @@ export class ProductListDataSource extends DataSource<Product> {
}), }),
); );
const matchesMenuCategory = menuCategory === '' || skus.some((k) => (k.menuCategory?.id ?? '') === menuCategory); const matchesMenuCategory = !menuCategory || skus.some((k) => (k.menuCategory?.id ?? '') === menuCategory);
return matchesSearch && matchesMenuCategory; return matchesSearch && matchesMenuCategory;
}); });
} }

View File

@ -75,9 +75,6 @@ export class ProductListComponent implements OnInit {
this.menuCategoryFilter.subscribe((val) => { this.menuCategoryFilter.subscribe((val) => {
console.log('Menu category filter changed to ', val); console.log('Menu category filter changed to ', val);
}); });
this.searchFilter.subscribe((val) => {
console.log('Search filter changed to ', val);
});
} }
filterOn(val: string) { filterOn(val: string) {