diff --git a/app/(main)/ClientComponents/Global.tsx b/app/(main)/ClientComponents/Global.tsx
index 5fe711f..cb58e6b 100644
--- a/app/(main)/ClientComponents/Global.tsx
+++ b/app/(main)/ClientComponents/Global.tsx
@@ -1,11 +1,30 @@
-import { GetNezhaData } from "@/lib/serverFetch";
+"use client";
+
+import { ServerApi } from "@/app/types/nezha-api";
+import { nezhaFetcher } from "@/lib/utils";
+import useSWR from "swr";
import { geoJsonString } from "../../../lib/geo-json-string";
import GlobalInfo from "./GlobalInfo";
+import GlobalLoading from "./GlobalLoading";
import { InteractiveMap } from "./InteractiveMap";
-export default async function ServerGlobal() {
- const nezhaServerList = await GetNezhaData();
+export default function ServerGlobal() {
+ const { data: nezhaServerList, error } = useSWR(
+ "/api/server",
+ nezhaFetcher,
+ );
+
+ if (error)
+ return (
+
+ );
+
+ if (!nezhaServerList) {
+ return ;
+ }
const countryList: string[] = [];
const serverCounts: { [key: string]: number } = {};
diff --git a/app/(main)/ClientComponents/ServerOverviewClient.tsx b/app/(main)/ClientComponents/ServerOverviewClient.tsx
index 235fecf..9a49d37 100644
--- a/app/(main)/ClientComponents/ServerOverviewClient.tsx
+++ b/app/(main)/ClientComponents/ServerOverviewClient.tsx
@@ -202,9 +202,7 @@ export default function ServerOverviewClient() {
- {formatBytes(
- data?.total_in_speed,
- )}/s
+ {formatBytes(data?.total_in_speed)}/s
>
diff --git a/app/(main)/page.tsx b/app/(main)/page.tsx
index 680118f..871fe51 100644
--- a/app/(main)/page.tsx
+++ b/app/(main)/page.tsx
@@ -1,10 +1,13 @@
import ServerList from "@/components/ServerList";
import ServerOverview from "@/components/ServerOverview";
-import { Suspense } from "react";
+import dynamic from "next/dynamic";
-import ServerGlobal from "./ClientComponents/Global";
import GlobalLoading from "./ClientComponents/GlobalLoading";
+const ServerGlobal = dynamic(() => import("./ClientComponents/Global"), {
+ loading: () => ,
+});
+
export default async function Home({
searchParams,
}: {
@@ -15,11 +18,7 @@ export default async function Home({
{!global && }
- {global && (
- }>
-
-
- )}
+ {global && }
);
}