fix(table): fix cross-filter not clearing on second click in Interactive Table (#39253)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit c2d96e0dce)
This commit is contained in:
Maxime Beauchemin
2026-04-15 10:30:36 -07:00
committed by Michael S. Molina
parent 1afa47bf80
commit ea040d3136
8 changed files with 369 additions and 54 deletions

View File

@@ -413,7 +413,16 @@ export default function TableChart<D extends DataRecord = DataRecord>(
const isActiveFilterValue = useCallback(
function isActiveFilterValue(key: string, val: DataRecordValue) {
return !!filters && filters[key]?.includes(val);
if (!filters || !filters[key]) return false;
return filters[key].some(filterVal => {
if (filterVal === val) return true;
// DateWithFormatter extends Date — compare by time value
// since memoization cache misses can create new instances
if (filterVal instanceof Date && val instanceof Date) {
return filterVal.getTime() === val.getTime();
}
return false;
});
},
[filters],
);