reload on team change

This commit is contained in:
Alex Holliday committed 2025-12-15 19:39:23 +00:00
1 parent 4e3630465c
commit e4183baf75
6 files changed
+37 -7

No files matched your search

+1 -1
View File
@@ -37,7 +37,7 @@ export const TeamSwitch = () => {
const handleMenu = (teamId: string) => { const handleMenu = (teamId: string) => {
dispatch(setSelectedTeamId(teamId)); dispatch(setSelectedTeamId(teamId));
navigate("/"); // navigate("/");
handleClose(); handleClose();
}; };
+6 -1
View File
@@ -13,6 +13,7 @@ import { useGet } from "@/hooks/UseApi";
import type { ApiResponse } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi";
import type { IMonitor } from "@/types/monitor"; import type { IMonitor } from "@/types/monitor";
import type { ICheck } from "@/types/check"; import type { ICheck } from "@/types/check";
import { config } from "@/config/index";
const ChecksPage = () => { const ChecksPage = () => {
const theme = useTheme(); const theme = useTheme();
@@ -42,7 +43,11 @@ const ChecksPage = () => {
selectedMonitorId !== "all" ? `&monitorId=${selectedMonitorId}` : "" selectedMonitorId !== "all" ? `&monitorId=${selectedMonitorId}` : ""
}`, }`,
{}, {},
{ keepPreviousData: true }, {
keepPreviousData: true,
refreshInterval: config.GLOBAL_REFRESH,
dedupingInterval: 0,
},
{ useTeamIdAsKey: true } { useTeamIdAsKey: true }
); );
+6 -1
View File
@@ -14,6 +14,7 @@ import type { ApiResponse } from "@/hooks/UseApi";
import type { SelectChangeEvent } from "@mui/material/Select"; import type { SelectChangeEvent } from "@mui/material/Select";
import type { IIncident } from "@/types/incident"; import type { IIncident } from "@/types/incident";
import type { IMonitor } from "@/types/monitor"; import type { IMonitor } from "@/types/monitor";
import { config } from "@/config/index";
const IncidentsPage = () => { const IncidentsPage = () => {
const theme = useTheme(); const theme = useTheme();
@@ -37,7 +38,11 @@ const IncidentsPage = () => {
: "" : ""
}${resolved !== null ? `&resolved=${resolved}` : ""}`, }${resolved !== null ? `&resolved=${resolved}` : ""}`,
{}, {},
{ keepPreviousData: true }, {
keepPreviousData: true,
refreshInterval: config.GLOBAL_REFRESH,
dedupingInterval: 0,
},
{ useTeamIdAsKey: true } { useTeamIdAsKey: true }
); );
@@ -19,7 +19,6 @@ import useMediaQuery from "@mui/material/useMediaQuery";
import { useState } from "react"; import { useState } from "react";
import { useDelete } from "@/hooks/UseApi"; import { useDelete } from "@/hooks/UseApi";
import { InitializingStatusBox } from "@/components/design-elements/StatusBox"; import { InitializingStatusBox } from "@/components/design-elements/StatusBox";
import { useAppSelector } from "@/hooks/AppHooks";
import { config } from "@/config/index"; import { config } from "@/config/index";
import { useLimitReached } from "@/hooks/UsePlanEntitlements"; import { useLimitReached } from "@/hooks/UsePlanEntitlements";
@@ -28,7 +27,6 @@ const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
const PageSpeedMonitorsPage = () => { const PageSpeedMonitorsPage = () => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
const { user } = useAppSelector((state) => state.auth);
const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const [selectedMonitor, setSelectedMonitor] = useState<IMonitor | null>(null); const [selectedMonitor, setSelectedMonitor] = useState<IMonitor | null>(null);
const isDialogOpen = Boolean(selectedMonitor); const isDialogOpen = Boolean(selectedMonitor);
+9 -1
View File
@@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next";
import type { ApiResponse } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi";
import type { IMaintenance } from "@/types/maintenance"; import type { IMaintenance } from "@/types/maintenance";
import type { ActionMenuItem } from "@/components/actions-menu"; import type { ActionMenuItem } from "@/components/actions-menu";
import { config } from "@/config/index";
const MaintenancePage = () => { const MaintenancePage = () => {
const theme = useTheme(); const theme = useTheme();
@@ -26,7 +27,14 @@ const MaintenancePage = () => {
const { response, isValidating, refetch } = useGet<ApiResponse<any>>( const { response, isValidating, refetch } = useGet<ApiResponse<any>>(
"/maintenance", "/maintenance",
{}, {},
{} {
refreshInterval: config.GLOBAL_REFRESH,
keepPreviousData: true,
dedupingInterval: 0,
},
{
useTeamIdAsKey: true,
}
); );
const { deleteFn, loading: isDeleting } = useDelete<any>(); const { deleteFn, loading: isDeleting } = useDelete<any>();
+15 -1
View File
@@ -8,6 +8,9 @@ import type { IStatusPage } from "@/types/status-page";
import { useGet, useDelete } from "@/hooks/UseApi"; import { useGet, useDelete } from "@/hooks/UseApi";
import type { ApiResponse } from "@/hooks/UseApi"; import type { ApiResponse } from "@/hooks/UseApi";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { config } from "@/config/index";
const GLOBAL_REFRESH = config.GLOBAL_REFRESH;
const StatusPages = () => { const StatusPages = () => {
const [page, setPage] = useState(0); const [page, setPage] = useState(0);
@@ -19,7 +22,18 @@ const StatusPages = () => {
const { response, isValidating, error, refetch } = useGet< const { response, isValidating, error, refetch } = useGet<
ApiResponse<{ statusPages: IStatusPage[]; count: number }> 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 statusPages = response?.data?.statusPages || [];
const count = response?.data?.count || 0; const count = response?.data?.count || 0;