mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-30 05:09:44 -06:00
Fix: Rogue effect hook, some more cleanup (#2329)
* fix: remove effect hook * fix: filter counts * fix: x mark button
This commit is contained in:
@@ -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)}
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user