Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

refactor(frontend): inline getColumnId into data-table.tsx

Sergey Kozyrenko38bc1deda977
diff --git a/frontend/src/components/ui/data-table.tsx b/frontend/src/components/ui/data-table.tsx
index 8ba44d4f..20e4a56e 100644
--- a/frontend/src/components/ui/data-table.tsx
+++ b/frontend/src/components/ui/data-table.tsx
@@ -44,7 +44,6 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
import { useEffectAfterMount } from '@/hooks/use-effect-after-mount';
import { useLatestRef } from '@/hooks/use-latest-ref';
import { usePageStorageKeys } from '@/hooks/use-page-storage-keys';
-import { getColumnId } from '@/lib/column-utils';
import { migrateLegacyTableState, updateTableState } from '@/lib/table-state';
import { cn } from '@/lib/utils';
@@ -102,6 +101,24 @@ const PAGE_SIZE_OPTIONS = [10, 15, 20, 50, 100] as const;
const columnPickerLabel = <TData,>(column: Column<TData, unknown>): string =>
column.columnDef.meta?.columnMenuLabel ?? column.id;
+/**
+ * Resolve a `ColumnDef`'s id the way TanStack does internally: explicit `id`
+ * wins, then `accessorKey` when it's a plain string. Display columns and
+ * `accessorFn` columns without an explicit id resolve to `undefined` —
+ * callers filter those out before passing the id to APIs that require one.
+ */
+const getColumnId = <TData, TValue>(column: ColumnDef<TData, TValue>): string | undefined => {
+ const withId = column as { id?: string };
+
+ if (withId.id) {
+ return withId.id;
+ }
+
+ const withAccessor = column as { accessorKey?: string };
+
+ return typeof withAccessor.accessorKey === 'string' ? withAccessor.accessorKey : undefined;
+};
+
interface DataTableFilterProps<TData> {
placeholder: string;
table: ReactTable<TData>;
diff --git a/frontend/src/lib/column-utils.ts b/frontend/src/lib/column-utils.ts
deleted file mode 100644
index 1ec72dcd..00000000
--- a/frontend/src/lib/column-utils.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import type { ColumnDef } from '@tanstack/react-table';
-
-/**
- * Resolve a TanStack `ColumnDef`'s id the way TanStack does internally:
- * explicit `id` wins, then `accessorKey` when it's a plain string. Display
- * columns and `accessorFn` columns without an explicit id resolve to
- * `undefined` — callers must filter those out before passing the id to
- * APIs that require one (e.g. `getColumn`, predicate matching).
- */
-export const getColumnId = <TData, TValue>(column: ColumnDef<TData, TValue>): string | undefined => {
- const withId = column as { id?: string };
-
- if (withId.id) {
- return withId.id;
- }
-
- const withAccessor = column as { accessorKey?: string };
-
- return typeof withAccessor.accessorKey === 'string' ? withAccessor.accessorKey : undefined;
-};