From 95cef6192766ae9ab138a1a0a95d40210cd8b005 Mon Sep 17 00:00:00 2001 From: Salihu <91833785+salihudickson@users.noreply.github.com> Date: Tue, 25 Aug 2026 02:52:24 +0100 Subject: [PATCH] fix: rework filtering behaviour (#2413) * rework filtering behaviour * fix classification bug --- .../components/views/view-filter-config.tsx | 112 +++++++++++++----- 1 file changed, 85 insertions(+), 27 deletions(-) diff --git a/apps/client/src/ee/base/components/views/view-filter-config.tsx b/apps/client/src/ee/base/components/views/view-filter-config.tsx index c860845d5..c0c4c463d 100644 --- a/apps/client/src/ee/base/components/views/view-filter-config.tsx +++ b/apps/client/src/ee/base/components/views/view-filter-config.tsx @@ -9,6 +9,7 @@ import { Text, UnstyledButton, Button, + MultiSelect, } from "@mantine/core"; import { IconPlus, IconTrash } from "@tabler/icons-react"; import { @@ -52,6 +53,9 @@ const NO_VALUE_OPERATORS: FilterOperator[] = ["isEmpty", "isNotEmpty"]; // stored value so a stale shape isn't sent to the engine. function valueClass(op: FilterOperator, inputKind: string): string { if (NO_VALUE_OPERATORS.includes(op)) return "none"; + if (inputKind === "choices") { + return op === "any" || op === "none" ? "choicesMulti" : "choicesSingle"; + } if (inputKind === "person") { return op === "any" || op === "none" ? "personMulti" : "personSingle"; } @@ -70,6 +74,10 @@ function getOperatorsForType(type: string): FilterOperator[] { DEFAULT_FILTER_OPERATORS) as FilterOperator[]; } +function isMultiChoice(op: FilterCondition["op"]): boolean { + return op === "any" || op === "none"; +} + function FilterValueInput({ condition, property, @@ -121,6 +129,32 @@ function FilterValueInput({ const typeOptions = property.typeOptions as SelectTypeOptions | undefined; const choices = typeOptions?.choices ?? []; const choiceOptions = choices.map((c) => ({ value: c.id, label: c.name })); + + if (isMultiChoice(condition.op)) { + const { value } = condition; + const selected = ( + Array.isArray(value) ? value : value ? [value] : [] + ).filter((id) => choices.some((c) => c.id === id)); + + return ( + onChange(values)} + w={160} + styles={{ + pillsList: { + maxHeight: 70, + overflowY: "auto", + }, + }} + maxDropdownHeight={220} + /> + ); + } + return (