Fix: Rogue effect hook, some more cleanup (#2329)

* fix: remove effect hook

* fix: filter counts

* fix: x mark button
This commit is contained in:
matt
2025-09-23 17:47:49 -04:00
committed by GitHub
parent 63c644577a
commit df236cf668
2 changed files with 24 additions and 28 deletions

View File

@@ -468,8 +468,8 @@ export function DataTableOptions<TData>({
if (
f.id === createdAfterKey ||
f.id === finishedBeforeKey ||
f.id === isCustomTimeRangeKey ||
f.id === timeWindowKey
(f.id === isCustomTimeRangeKey && f.value !== true) ||
(f.id === timeWindowKey && f.value === '1d')
) {
return false;
}
@@ -603,20 +603,27 @@ function FiltersContent<TData>({
{filter.title}
</label>
{table.getColumn(filter.columnId)?.getFilterValue() !==
undefined && (
<Button
variant="ghost"
size="sm"
onClick={() =>
table
.getColumn(filter.columnId)
?.setFilterValue(undefined)
}
className="h-6 w-6 p-0 text-muted-foreground hover:text-foreground"
>
<Cross2Icon className="h-3 w-3" />
</Button>
)}
undefined &&
[
ToolbarType.Array,
ToolbarType.KeyValue,
ToolbarType.Checkbox,
ToolbarType.TimeRange,
ToolbarType.Radio,
].includes(filter.type) && (
<Button
variant="ghost"
size="sm"
onClick={() =>
table
.getColumn(filter.columnId)
?.setFilterValue(undefined)
}
className="h-6 w-6 p-0 text-muted-foreground hover:text-foreground"
>
<Cross2Icon className="h-3 w-3" />
</Button>
)}
</div>
<FilterControl
column={table.getColumn(filter.columnId)}

View File

@@ -1,4 +1,4 @@
import { useCallback, useMemo, useRef, useEffect } from 'react';
import { useCallback, useMemo } from 'react';
import { useSearchParams } from 'react-router-dom';
import { V1TaskStatus } from '@/lib/api';
import { ColumnFiltersState } from '@tanstack/react-table';
@@ -124,17 +124,6 @@ export const useRunsTableFilters = (initialValues?: {
[zodState, setSearchParams, paramKey],
);
const hasInitialized = useRef(false);
useEffect(() => {
if (!hasInitialized.current && !rawCreatedAfter && !isCustomTimeRange) {
hasInitialized.current = true;
setZodState({
...zodState,
s: getCreatedAfterFromTimeRange(timeWindow),
});
}
}, [rawCreatedAfter, isCustomTimeRange, timeWindow, zodState, setZodState]);
const setTimeWindow = useCallback(
(timeWindow: TimeWindow) => {
setZodState({