perf : increase admin page speed

This commit is contained in:
2026-10-01 13:03:38 +07:00 Unverified
parent 9c91561abe
commit c5037154cb
7 changed files with 164 additions and 24 deletions
+4 -6
View File
@@ -11,7 +11,7 @@ import { EditorPresence } from "@/components/admin/editor-presence";
import { Button } from "@/components/ui/button";
import { getAdminSession } from "@/lib/auth/server";
import {
getActiveCatalog,
getCatalogOptions,
getAdminGuideContent,
getGuideEditorHeader,
} from "@/lib/guides/queries";
@@ -53,13 +53,11 @@ export default async function StructuredEditorPage({
?? guide.sections.find((section) => section.slug === page)?.title
?? page;
const [catalog, content] = await Promise.all([
getActiveCatalog(),
getAdminGuideContent(guide.slug),
getCatalogOptions(),
getAdminGuideContent(guide.slug, page),
]);
if (!catalog || !content) notFound();
const guideCharacter = catalog.characters.find(
(item) => item.key === guide.characterKey,
);
const guideCharacter = content.character;
return (
<div className="min-h-svh">
<AdminHeader />
+2 -2
View File
@@ -5,13 +5,13 @@ import { AdminHeader } from "@/components/admin/admin-header";
import { GlossaryManager } from "@/components/admin/glossary-manager";
import { getAdminSession } from "@/lib/auth/server";
import { listGlossaryAliases } from "@/lib/glossary-repository";
import { getActiveCatalog } from "@/lib/guides/queries";
import { getCatalogOptions } from "@/lib/guides/queries";
export default async function GlossaryPage() {
await connection();
if (!(await getAdminSession())) redirect("/admin/login");
const [catalog, aliases] = await Promise.all([
getActiveCatalog(),
getCatalogOptions(),
listGlossaryAliases(),
]);
if (!catalog) redirect("/admin");
+7
View File
@@ -0,0 +1,7 @@
export default function AdminLoading() {
return (
<main className="mx-auto flex min-h-svh w-full max-w-7xl items-start p-4 sm:p-6 lg:p-8">
<p role="status" className="text-sm text-muted-foreground">กำลังโหลด…</p>
</main>
);
}