mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
fix(detail): detail page api dedupingInterval
This commit is contained in:
parent
2b426c8d18
commit
1e881f5d9f
@ -5,7 +5,6 @@ import { NezhaAPISafe, ServerApi } from "@/app/types/nezha-api";
|
|||||||
import AnimatedCircularProgressBar from "@/components/ui/animated-circular-progress-bar";
|
import AnimatedCircularProgressBar from "@/components/ui/animated-circular-progress-bar";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { ChartConfig, ChartContainer } from "@/components/ui/chart";
|
import { ChartConfig, ChartContainer } from "@/components/ui/chart";
|
||||||
import getEnv from "@/lib/env-entry";
|
|
||||||
import {
|
import {
|
||||||
formatBytes,
|
formatBytes,
|
||||||
formatNezhaInfo,
|
formatNezhaInfo,
|
||||||
@ -23,7 +22,6 @@ import {
|
|||||||
XAxis,
|
XAxis,
|
||||||
YAxis,
|
YAxis,
|
||||||
} from "recharts";
|
} from "recharts";
|
||||||
import useSWR from "swr";
|
|
||||||
import useSWRImmutable from "swr/immutable";
|
import useSWRImmutable from "swr/immutable";
|
||||||
|
|
||||||
type cpuChartData = {
|
type cpuChartData = {
|
||||||
@ -61,7 +59,6 @@ type connectChartData = {
|
|||||||
|
|
||||||
export default function ServerDetailChartClient({
|
export default function ServerDetailChartClient({
|
||||||
server_id,
|
server_id,
|
||||||
show,
|
|
||||||
}: {
|
}: {
|
||||||
server_id: number;
|
server_id: number;
|
||||||
show: boolean;
|
show: boolean;
|
||||||
@ -76,15 +73,11 @@ export default function ServerDetailChartClient({
|
|||||||
(item) => item.id === server_id,
|
(item) => item.id === server_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data, error } = useSWR<NezhaAPISafe>(
|
const { data, error } = useSWRImmutable<NezhaAPISafe>(
|
||||||
`/api/detail?server_id=${server_id}`,
|
`/api/detail?server_id=${server_id}`,
|
||||||
nezhaFetcher,
|
nezhaFetcher,
|
||||||
{
|
{
|
||||||
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 5000,
|
|
||||||
isVisible: () => show,
|
|
||||||
fallbackData,
|
fallbackData,
|
||||||
revalidateOnMount: false,
|
|
||||||
revalidateIfStale: false,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ export default function ServerDetailClient({
|
|||||||
nezhaFetcher,
|
nezhaFetcher,
|
||||||
{
|
{
|
||||||
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 5000,
|
refreshInterval: Number(getEnv("NEXT_PUBLIC_NezhaFetchInterval")) || 5000,
|
||||||
|
dedupingInterval: 1000,
|
||||||
fallbackData,
|
fallbackData,
|
||||||
revalidateOnMount: false,
|
revalidateOnMount: false,
|
||||||
revalidateIfStale: false,
|
revalidateIfStale: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user