Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,21 @@ export const ConversationAccordion = ({ projectId }: { projectId: string }) => {
return prev.filter((f) => f !== filterValue);
}

// Case 1.5: if no filters are active, toggle all filters
if (prev.length === 1) {
return allFilterValues;
// Case 2: If the filter is inactive, toggle it on
if (!isActive) {
return [...prev, filterValue];
}

// Case 2: If the filter is already active, toggle it off
if (isActive) {
// Remove it from active filters
return prev.filter((f) => f !== filterValue);
// Case 3: If the filter is active but it's the only active filter
// don't allow removing the last filter (prevent zero filters)
if (prev.length === 1) {
// Keep at least one filter active
return prev;
}

// Case 3: If the filter is inactive, toggle it on
return [...prev, filterValue];
// Case 4: If the filter is active and there are other active filters,
// toggle it off
return prev.filter((f) => f !== filterValue);
});
};

Expand Down