Compare commits

...
Author SHA1 Message Date
Sonarly Claude CodeandClaude Opus 4.6 ebc224ae3b Fix multi-select filter crash when 'in' operator is used
The isMatchingMultiSelectFilter function did not handle the 'in' filter
operator, causing a runtime error when a multi-select field received an
'in' filter (e.g. after converting a SELECT field to MULTI_SELECT while
a view filter was active). Added 'in' support to both the
MultiSelectFilter type and the matching function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:21:16 +00:00
3 changed files with 45 additions and 0 deletions
@@ -125,6 +125,7 @@ export type SelectFilter = {
export type MultiSelectFilter = {
is?: IsFilter;
in?: string[];
isEmptyArray?: boolean;
containsAny?: string[];
};
@@ -1,6 +1,44 @@
import { isMatchingMultiSelectFilter } from '@/utils/filter/utils/isMatchingMultiSelectFilter';
describe('isMatchingMultiSelectFilter', () => {
describe('in', () => {
it('should return true when at least one value is in the filter list', () => {
expect(
isMatchingMultiSelectFilter({
multiSelectFilter: { in: ['A', 'B'] },
value: ['A', 'C'],
}),
).toBe(true);
});
it('should return false when no value is in the filter list', () => {
expect(
isMatchingMultiSelectFilter({
multiSelectFilter: { in: ['A', 'B'] },
value: ['C', 'D'],
}),
).toBe(false);
});
it('should return false for null value', () => {
expect(
isMatchingMultiSelectFilter({
multiSelectFilter: { in: ['A'] },
value: null,
}),
).toBe(false);
});
it('should return false for empty array value', () => {
expect(
isMatchingMultiSelectFilter({
multiSelectFilter: { in: ['A'] },
value: [],
}),
).toBe(false);
});
});
describe('containsAny', () => {
it('should return true when value contains all filter items', () => {
expect(
@@ -8,6 +8,12 @@ export const isMatchingMultiSelectFilter = ({
value: string[] | null;
}) => {
switch (true) {
case multiSelectFilter.in !== undefined: {
return (
Array.isArray(value) &&
value.some((item) => multiSelectFilter.in!.includes(item))
);
}
case multiSelectFilter.containsAny !== undefined: {
return (
Array.isArray(value) &&