From f8bfbde9b58beb09299c2f0ad4a2f15df20b326a Mon Sep 17 00:00:00 2001
From: hamster1963 <1410514192@qq.com>
Date: Thu, 5 Dec 2024 14:45:58 +0800
Subject: [PATCH] perf: refactor global map as client side render
---
app/(main)/ClientComponents/Global.tsx | 25 ++++++++++++++++---
.../ClientComponents/ServerOverviewClient.tsx | 4 +--
app/(main)/page.tsx | 13 +++++-----
3 files changed, 29 insertions(+), 13 deletions(-)
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 {error.message}