fix(shop): update symptom filtering to OR logic instead of AND logic
- Allow users to select multiple symptoms and view products matching ANY of the selected symptoms
This commit is contained in:
parent
dc8a1bb079
commit
22dc217534
@ -298,9 +298,9 @@ export default function ArchivePage({
|
||||
});
|
||||
|
||||
let result = res.data;
|
||||
// If multiple symptoms selected, do client-side intersection (rare case)
|
||||
if (activeSymptoms.length > 1) {
|
||||
result = result.filter(p => activeSymptoms.every(s => p.symptoms.includes(s)));
|
||||
// If multiple symptoms selected, filter with OR logic (union of symptoms)
|
||||
if (activeSymptoms.length > 0) {
|
||||
result = result.filter(p => p.symptoms && p.symptoms.some(s => activeSymptoms.includes(s)));
|
||||
}
|
||||
|
||||
setFilteredProducts(result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user