Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
refactor(frontend): drop dead storage plumbing from filter readers
Sergey Kozyrenko4888568a7eed
diff --git a/frontend/src/components/shared/detail-navigation/use-detail-navigation.ts b/frontend/src/components/shared/detail-navigation/use-detail-navigation.tsindex b05becd6..c6536bde 100644--- a/frontend/src/components/shared/detail-navigation/use-detail-navigation.ts+++ b/frontend/src/components/shared/detail-navigation/use-detail-navigation.ts@@ -2,7 +2,6 @@ import { useCallback, useMemo, useState } from 'react';import { useNavigate, useSearchParams } from 'react-router-dom';import { useLatestRef } from '@/hooks/use-latest-ref';-import { usePageStorageKeys } from '@/hooks/use-page-storage-keys';import { useTableQueryFilterReader } from '@/hooks/use-table-query-filter';import { mergeHrefWithSearchParams } from '@/lib/url-params';@@ -76,15 +75,6 @@ export interface DetailNavigationController<T extends { id: string }> {total: number;}-/**- * Restricts the override to strings that start with a `/`. Pure-string types- * (`string`) would let an empty `""` or a bare `"flows"` slip through and- * either collide on the shared `filter_4_` key or generate a different slot- * than the actual list page. Template-literal types catch this at compile- * time without runtime guards.- */-type ParentPath = `/${string}`;-interface UseDetailNavigationOptions<T extends { id: string }> {currentId: null | string | undefined;/** Initial value for the uncontrolled case. Defaults to `false`. */@@ -106,15 +96,6 @@ interface UseDetailNavigationOptions<T extends { id: string }> {* `@/components/ui/autocomplete.tsx`.*/open?: boolean;- /**- * Optional override for the parent list path used to look up the shared- * filter storage slot. Defaults to the top-level segment of the current- * pathname, which works for top-level routes (`/flows`, `/templates`,- * `/knowledges`). Nested routes (`/admin/flows/:id`) must pass an- * explicit value here because the default would key into `/admin`- * rather than `/admin/flows`.- */- parentPath?: ParentPath;sortFn?: (a: T, b: T) => number;}@@ -127,12 +108,11 @@ const defaultGetId = (item: { id: string }): string => item.id;/*** Build the headless `DetailNavigationController<T>` for a detail page.*- * Bundles the four moving parts every detail page repeats:- * 1. resolving the parent list's storage slot via `usePageStorageKeys`,- * 2. subscribing to the URL filter through `useTableQueryFilterReader`+ * Bundles the three moving parts every detail page repeats:+ * 1. subscribing to the URL filter through `useTableQueryFilterReader`* (read-only — the detail page never mutates the filter from here),- * 3. running the pure `useNavigation` core against the filtered subset,- * 4. wiring identity-stable `goToPrev` / `goToNext` / `handleItemSelect`+ * 2. running the pure `useNavigation` core against the filtered subset,+ * 3. wiring identity-stable `goToPrev` / `goToNext` / `handleItemSelect`* with `?<filter>=` forwarded through `mergeHrefWithSearchParams`.** The returned controller drives `<DetailNavigationToolbar>`,@@ -160,20 +140,12 @@ export function useDetailNavigation<T extends { id: string }>({items,onOpenChange,open,- parentPath,sortFn,}: UseDetailNavigationOptions<T>): DetailNavigationController<T> {const navigate = useNavigate();const [searchParams] = useSearchParams();- // `parentPath` is typed as `/${string}` so the empty / unprefixed case- // is rejected at compile time — we only need to branch on presence here.- const hasExplicitParentPath = parentPath !== undefined;- const { table: filterStorageKey } = usePageStorageKeys({- pathname: hasExplicitParentPath ? parentPath : undefined,- useTopLevel: !hasExplicitParentPath,- });- const { debouncedFilter } = useTableQueryFilterReader({ storageKey: filterStorageKey });+ const { debouncedFilter } = useTableQueryFilterReader();// Memoize so passing `getId={undefined}` keeps the reference stable when// the caller re-renders for unrelated reasons. Without the memo thediff --git a/frontend/src/features/resources/use-resources-search.ts b/frontend/src/features/resources/use-resources-search.tsindex bee824c8..ccd5dbaa 100644--- a/frontend/src/features/resources/use-resources-search.ts+++ b/frontend/src/features/resources/use-resources-search.ts@@ -12,11 +12,11 @@ interface UseResourcesSearchResult {/*** Search state for the Resources file manager.*- * Backed by `useTableState` so the query lives in the URL (`?q=`) with a- * localStorage fallback — the FileManager survives reloads with the same- * filter active and shareable links keep working. The debounce delay is- * preserved (`SEARCH_DEBOUNCE_MS`) so the existing client-side tree filter- * still gets the throttled value it expects.+ * Backed by `useTableState` so the query lives in the URL (`?q=`) — reloads+ * keep the filter active and shareable links work, but a fresh navigation+ * back to `/resources` starts clean. The debounce delay is preserved+ * (`SEARCH_DEBOUNCE_MS`) so the existing client-side tree filter still gets+ * the throttled value it expects.** `clearPageOnFilterChange: false` because Resources has no `?page=` to* reset — leaving the default would also work (deleting a non-existentdiff --git a/frontend/src/hooks/use-table-query-filter.ts b/frontend/src/hooks/use-table-query-filter.tsindex dc93ee1d..0614365a 100644--- a/frontend/src/hooks/use-table-query-filter.ts+++ b/frontend/src/hooks/use-table-query-filter.ts@@ -10,13 +10,6 @@ interface UseTableQueryFilterReaderOptions {* The query string param to read. Default `URL_PARAMS.QUERY` (`'q'`).*/paramName?: string;- /**- * Storage key — accepted for API symmetry with `useTableState` and the- * historical mutate variant, but ignored here. The reader is pure-URL- * and never touches storage; the option exists only so detail pages can- * pass the parent list's storage key without conditional logic.- */- storageKey?: string;}interface UseTableQueryFilterReaderResult {@@ -29,12 +22,11 @@ interface UseTableQueryFilterReaderResult {* but never mutate it (typically detail pages, where the toolbar walks the* filtered subset but the user types the filter on the list page).*- * The hook never writes to the URL or storage: a detail page opened via a- * shared `/flows/:id` link will not silently inject the previous tab's- * `?q=` into the URL. Pages that *do* need to mutate the filter live on- * `useTableState` instead — it owns the URL ↔ storage roundtrip plus- * atomic multi-field updates that the previous split design couldn't do- * race-free.+ * The hook never writes to the URL: a detail page opened via a shared+ * `/flows/:id` link will not silently inject the previous tab's `?q=` into+ * the URL. Pages that *do* need to mutate the filter live on+ * `useTableState` instead — it owns the URL writes plus atomic multi-field+ * updates that the previous split design couldn't do race-free.*/export function useTableQueryFilterReader({debounceMs = 200,