From bd41ad813cf3df9fff01d8d47e8a0b3ea40ddfc3 Mon Sep 17 00:00:00 2001 From: henrygd Date: Fri, 14 Nov 2025 13:54:23 -0500 Subject: [PATCH] change alert history pagination to use local storage instead of saving to user settings --- .../settings/alerts-history-data-table.tsx | 21 +++++++------------ internal/site/src/lib/stores.ts | 1 - internal/site/src/types.d.ts | 1 - 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/internal/site/src/components/routes/settings/alerts-history-data-table.tsx b/internal/site/src/components/routes/settings/alerts-history-data-table.tsx index 24619ae5..84758ba2 100644 --- a/internal/site/src/components/routes/settings/alerts-history-data-table.tsx +++ b/internal/site/src/components/routes/settings/alerts-history-data-table.tsx @@ -41,11 +41,8 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@ import { useToast } from "@/components/ui/use-toast" import { alertInfo } from "@/lib/alerts" import { pb } from "@/lib/api" -import { $userSettings } from "@/lib/stores" -import { cn, formatDuration, formatShortDate } from "@/lib/utils" +import { cn, formatDuration, formatShortDate, useBrowserStorage } from "@/lib/utils" import type { AlertsHistoryRecord } from "@/types" -import { saveSettings } from "./layout" -import { useStore } from "@nanostores/react" import { alertsHistoryColumns } from "../../alerts-history-columns" const SectionIntro = memo(() => { @@ -70,13 +67,12 @@ export default function AlertsHistoryDataTable() { const [globalFilter, setGlobalFilter] = useState("") const { toast } = useToast() const [deleteOpen, setDeleteDialogOpen] = useState(false) - const userSettings = useStore($userSettings) - // Initialize pagination with user preference - const [pagination, setPagination] = useState(() => ({ + // Store pagination preference in local storage + const [pagination, setPagination] = useBrowserStorage("ah-pagination", { pageIndex: 0, - pageSize: userSettings.alertHistoryPageSize || 10, - })) + pageSize: 10, + }) useEffect(() => { let unsubscribe: (() => void) | undefined @@ -331,13 +327,10 @@ export default function AlertsHistoryDataTable() {