mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
fix(ServerList): refreshInterval
This commit is contained in:
parent
7a31071c3d
commit
f28f559a0b
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { ServerApi } from "@/app/types/nezha-api";
|
import { ServerApi } from "@/app/types/nezha-api";
|
||||||
import { nezhaFetcher } from "@/lib/utils";
|
import { nezhaFetcher } from "@/lib/utils";
|
||||||
import useSWR from "swr";
|
import useSWRImmutable from "swr/immutable";
|
||||||
|
|
||||||
import { geoJsonString } from "../../../lib/geo-json-string";
|
import { geoJsonString } from "../../../lib/geo-json-string";
|
||||||
import GlobalInfo from "./GlobalInfo";
|
import GlobalInfo from "./GlobalInfo";
|
||||||
@ -11,7 +11,7 @@ import { InteractiveMap } from "./InteractiveMap";
|
|||||||
import { TooltipProvider } from "./TooltipContext";
|
import { TooltipProvider } from "./TooltipContext";
|
||||||
|
|
||||||
export default function ServerGlobal() {
|
export default function ServerGlobal() {
|
||||||
const { data: nezhaServerList, error } = useSWR<ServerApi>(
|
const { data: nezhaServerList, error } = useSWRImmutable<ServerApi>(
|
||||||
"/api/server",
|
"/api/server",
|
||||||
nezhaFetcher,
|
nezhaFetcher,
|
||||||
);
|
);
|
||||||
|
@ -75,6 +75,7 @@ export default function ServerListClient() {
|
|||||||
|
|
||||||
const { data, error } = useSWR<ServerApi>("/api/server", nezhaFetcher, {
|
const { data, error } = useSWR<ServerApi>("/api/server", nezhaFetcher, {
|
||||||
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 2000,
|
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 2000,
|
||||||
|
dedupingInterval: 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -14,18 +14,16 @@ import {
|
|||||||
} from "@heroicons/react/20/solid";
|
} from "@heroicons/react/20/solid";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import useSWR from "swr";
|
import useSWRImmutable from "swr/immutable";
|
||||||
|
|
||||||
export default function ServerOverviewClient() {
|
export default function ServerOverviewClient() {
|
||||||
const { status, setStatus } = useStatus();
|
const { status, setStatus } = useStatus();
|
||||||
const { filter, setFilter } = useFilter();
|
const { filter, setFilter } = useFilter();
|
||||||
const t = useTranslations("ServerOverviewClient");
|
const t = useTranslations("ServerOverviewClient");
|
||||||
const { data, error, isLoading } = useSWR<ServerApi>(
|
|
||||||
|
const { data, error, isLoading } = useSWRImmutable<ServerApi>(
|
||||||
"/api/server",
|
"/api/server",
|
||||||
nezhaFetcher,
|
nezhaFetcher,
|
||||||
{
|
|
||||||
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 2000,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";
|
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user