perf: disable router.refresh

This commit is contained in:
hamster1963 2024-09-26 12:37:13 +08:00
parent 9cedaf0c5a
commit 8d4b6b81b7
2 changed files with 4 additions and 6 deletions

View File

@ -1,4 +1,3 @@
import { useTranslations } from "next-intl";
import ServerList from "../../../components/ServerList"; import ServerList from "../../../components/ServerList";
import ServerOverview from "../../../components/ServerOverview"; import ServerOverview from "../../../components/ServerOverview";
import getEnv from "../../../lib/env-entry"; import getEnv from "../../../lib/env-entry";
@ -8,8 +7,8 @@ const disablePrefetch = getEnv("ServerDisablePrefetch") === "true";
const fallback = disablePrefetch const fallback = disablePrefetch
? {} ? {}
: { : {
"/api/server": GetNezhaData(), "/api/server": GetNezhaData(),
}; };
export default function Home() { export default function Home() {
return ( return (
<SWRConfig <SWRConfig

View File

@ -40,12 +40,11 @@ export function LanguageSwitcher() {
pathname === currentLocalePath || pathname === currentLocalePath ||
pathname === `${currentLocalePath}/` pathname === `${currentLocalePath}/`
) { ) {
router.replace(newLocalePath); router.push(newLocalePath);
} else { } else {
const newPath = constructLocalePath(pathname, newLocale); const newPath = constructLocalePath(pathname, newLocale);
router.replace(newPath); router.push(newPath);
} }
router.refresh();
}; };
return ( return (