diff --git a/src/admin/pages/AuditLog.tsx b/src/admin/pages/AuditLog.tsx index 9269eae..6ff410b 100644 --- a/src/admin/pages/AuditLog.tsx +++ b/src/admin/pages/AuditLog.tsx @@ -1,5 +1,5 @@ import { useState } from "react"; -import { useQuery } from "@tanstack/react-query"; +import { useQuery, keepPreviousData } from "@tanstack/react-query"; import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import { useAuth } from "../context/AuthContext"; @@ -128,7 +128,11 @@ export default function AuditLog() { // cleanupDays stored as string for the kit Select; converted to number at the boundary const [cleanupDaysStr, setCleanupDaysStr] = useState("90"); - const { data: logsData, isPending } = useQuery({ + const { + data: logsData, + isPending, + isFetching, + } = useQuery({ queryKey: [ "audit-log", { @@ -169,6 +173,10 @@ export default function AuditLog() { }, }; }, + // Keep the current rows on screen while a filter refetches, so the page + // doesn't drop to (which unmounts PageEnter and replays the + // whole entrance animation on every filter change). + placeholderData: keepPreviousData, }); const logs: AuditLogEntry[] = logsData?.data ?? []; @@ -352,7 +360,7 @@ export default function AuditLog() { - + columns={columns} rows={logs}