From e4183baf75fa8b8b8138f5c8642869cca179bc39 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 15 Dec 2025 19:39:23 +0000 Subject: [PATCH] reload on team change --- client/src/components/inputs/SwitchTeam.tsx | 2 +- client/src/pages/checks/ChecksPage.tsx | 7 ++++++- client/src/pages/incidents/IncidentsPage.tsx | 7 ++++++- .../src/pages/infrastructure/InfraMonitors.tsx | 2 -- client/src/pages/maintenance/Maintenance.tsx | 10 +++++++++- client/src/pages/status-page/StatusPages.tsx | 16 +++++++++++++++- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/client/src/components/inputs/SwitchTeam.tsx b/client/src/components/inputs/SwitchTeam.tsx index 96419c2b5..29839ecff 100644 --- a/client/src/components/inputs/SwitchTeam.tsx +++ b/client/src/components/inputs/SwitchTeam.tsx @@ -37,7 +37,7 @@ export const TeamSwitch = () => { const handleMenu = (teamId: string) => { dispatch(setSelectedTeamId(teamId)); - navigate("/"); + // navigate("/"); handleClose(); }; diff --git a/client/src/pages/checks/ChecksPage.tsx b/client/src/pages/checks/ChecksPage.tsx index 0fd82f430..8bd359844 100644 --- a/client/src/pages/checks/ChecksPage.tsx +++ b/client/src/pages/checks/ChecksPage.tsx @@ -13,6 +13,7 @@ import { useGet } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi"; import type { IMonitor } from "@/types/monitor"; import type { ICheck } from "@/types/check"; +import { config } from "@/config/index"; const ChecksPage = () => { const theme = useTheme(); @@ -42,7 +43,11 @@ const ChecksPage = () => { selectedMonitorId !== "all" ? `&monitorId=${selectedMonitorId}` : "" }`, {}, - { keepPreviousData: true }, + { + keepPreviousData: true, + refreshInterval: config.GLOBAL_REFRESH, + dedupingInterval: 0, + }, { useTeamIdAsKey: true } ); diff --git a/client/src/pages/incidents/IncidentsPage.tsx b/client/src/pages/incidents/IncidentsPage.tsx index 963078e01..6d42e94f7 100644 --- a/client/src/pages/incidents/IncidentsPage.tsx +++ b/client/src/pages/incidents/IncidentsPage.tsx @@ -14,6 +14,7 @@ import type { ApiResponse } from "@/hooks/UseApi"; import type { SelectChangeEvent } from "@mui/material/Select"; import type { IIncident } from "@/types/incident"; import type { IMonitor } from "@/types/monitor"; +import { config } from "@/config/index"; const IncidentsPage = () => { const theme = useTheme(); @@ -37,7 +38,11 @@ const IncidentsPage = () => { : "" }${resolved !== null ? `&resolved=${resolved}` : ""}`, {}, - { keepPreviousData: true }, + { + keepPreviousData: true, + refreshInterval: config.GLOBAL_REFRESH, + dedupingInterval: 0, + }, { useTeamIdAsKey: true } ); diff --git a/client/src/pages/infrastructure/InfraMonitors.tsx b/client/src/pages/infrastructure/InfraMonitors.tsx index 27d71c989..5df2f6f44 100644 --- a/client/src/pages/infrastructure/InfraMonitors.tsx +++ b/client/src/pages/infrastructure/InfraMonitors.tsx @@ -19,7 +19,6 @@ import useMediaQuery from "@mui/material/useMediaQuery"; import { useState } from "react"; import { useDelete } from "@/hooks/UseApi"; import { InitializingStatusBox } from "@/components/design-elements/StatusBox"; -import { useAppSelector } from "@/hooks/AppHooks"; import { config } from "@/config/index"; import { useLimitReached } from "@/hooks/UsePlanEntitlements"; @@ -28,7 +27,6 @@ const GLOBAL_REFRESH = config.GLOBAL_REFRESH; const PageSpeedMonitorsPage = () => { const theme = useTheme(); const { t } = useTranslation(); - const { user } = useAppSelector((state) => state.auth); const isSmall = useMediaQuery(theme.breakpoints.down("md")); const [selectedMonitor, setSelectedMonitor] = useState(null); const isDialogOpen = Boolean(selectedMonitor); diff --git a/client/src/pages/maintenance/Maintenance.tsx b/client/src/pages/maintenance/Maintenance.tsx index 41a2b9437..532eebfe4 100644 --- a/client/src/pages/maintenance/Maintenance.tsx +++ b/client/src/pages/maintenance/Maintenance.tsx @@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next"; import type { ApiResponse } from "@/hooks/UseApi"; import type { IMaintenance } from "@/types/maintenance"; import type { ActionMenuItem } from "@/components/actions-menu"; +import { config } from "@/config/index"; const MaintenancePage = () => { const theme = useTheme(); @@ -26,7 +27,14 @@ const MaintenancePage = () => { const { response, isValidating, refetch } = useGet>( "/maintenance", {}, - {} + { + refreshInterval: config.GLOBAL_REFRESH, + keepPreviousData: true, + dedupingInterval: 0, + }, + { + useTeamIdAsKey: true, + } ); const { deleteFn, loading: isDeleting } = useDelete(); diff --git a/client/src/pages/status-page/StatusPages.tsx b/client/src/pages/status-page/StatusPages.tsx index a8cb3282c..946b73370 100644 --- a/client/src/pages/status-page/StatusPages.tsx +++ b/client/src/pages/status-page/StatusPages.tsx @@ -8,6 +8,9 @@ import type { IStatusPage } from "@/types/status-page"; import { useGet, useDelete } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi"; import { useTranslation } from "react-i18next"; +import { config } from "@/config/index"; + +const GLOBAL_REFRESH = config.GLOBAL_REFRESH; const StatusPages = () => { const [page, setPage] = useState(0); @@ -19,7 +22,18 @@ const StatusPages = () => { const { response, isValidating, error, refetch } = useGet< ApiResponse<{ statusPages: IStatusPage[]; count: number }> - >(`/status-pages?page=${page}&rowsPerPage=${rowsPerPage}`, {}, {}); + >( + `/status-pages?page=${page}&rowsPerPage=${rowsPerPage}`, + {}, + { + refreshInterval: GLOBAL_REFRESH, + keepPreviousData: true, + dedupingInterval: 0, + }, + { + useTeamIdAsKey: true, + } + ); const statusPages = response?.data?.statusPages || []; const count = response?.data?.count || 0;