Added caching

This commit is contained in:
2025-09-08 19:49:05 +02:00
parent 5781880be4
commit a926b74d65
6 changed files with 52 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import { getExactLevel } from "@/lib/hypixel/general/level"
import { Loader2Icon, ShieldAlert } from "lucide-react"
import { Metadata } from "next"
import { Suspense } from "react"
import { PlayerPageLoadText } from "./_client"
import Sidebar from "./_components/Sidebar"
import BedwarsStats from "./_stats/bedwars/bedwars"
import BuildBattleStats from "./_stats/build-battle/build-battle"
@@ -27,7 +28,7 @@ export async function generateMetadata({ params }: { params: Promise<{ ign: stri
return { title: user !== null ? user.name : "Player not found" }
}
export default async function PlayerPage({ params }: PageProps<"/player/[ign]">) {
export default function PlayerPage({ params }: PageProps<"/player/[ign]">) {
const maintenance = env.MAINTENANCE_MODE
if (maintenance) {
@@ -39,23 +40,23 @@ export default async function PlayerPage({ params }: PageProps<"/player/[ign]">)
)
}
const { ign } = await params
return (
<Suspense
fallback={
<div className="flex flex-col justify-center items-center h-screen">
<Loader2Icon className="animate-spin size-30" />
<p>{`Loading stats for ${ign}`}</p>
<PlayerPageLoadText />
</div>
}
>
<SuspendedPage ign={ign} />
<SuspendedPage params={params} />
</Suspense>
)
}
async function SuspendedPage({ ign: pign }: { ign: string }) {
async function SuspendedPage({ params }: Pick<PageProps<"/player/[ign]">, "params">) {
const { ign: pign } = await params
const mc = await getUuid(pign)
if (!mc) {
return (