diff --git a/packages/components/src/ui/data-table-filter/lib/array.ts b/packages/components/src/ui/data-table-filter/lib/array.ts index af9b218d..7745b079 100644 --- a/packages/components/src/ui/data-table-filter/lib/array.ts +++ b/packages/components/src/ui/data-table-filter/lib/array.ts @@ -97,9 +97,19 @@ function deepEqual(a: unknown, b: unknown): boolean { export function uniq(arr: T[]): T[] { // Use a Map where key is the deep hash and value is an array of items sharing the same hash. const seen = new Map(); + const primitives = new Set(); const result: T[] = []; for (const item of arr) { + const type = typeof item; + if (item === null || (type !== 'object' && type !== 'function')) { + if (!primitives.has(item)) { + primitives.add(item); + result.push(item); + } + continue; + } + const hash = deepHash(item); if (seen.has(hash)) { // There is a potential duplicate; check the stored items with the same hash.