perf : increase admin page speed
This commit is contained in:
@@ -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 />
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user