Polish catalog studio: undo delete, save status pill, faster totals

This commit is contained in:
openhands committed 2026-09-14 18:24:47 +02:00
1 parent 6e0ffff94b
commit 67430e7e9d
5 files changed
+187 -9

No files matched your search

+8 -1
View File
@@ -1,5 +1,6 @@
import { asc, count, eq, or } from "drizzle-orm";
import { Crown, Store, Wrench } from "lucide-react";
import { unstable_cache } from "next/cache";
import Link from "next/link";
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
@@ -42,6 +43,12 @@ async function loadTotals(catalogType: "normal" | "bc"): Promise<Totals> {
};
}
const getCachedTotals = unstable_cache(
async (catalogType: "normal" | "bc") => loadTotals(catalogType),
["admin-catalog-totals"],
{ revalidate: 30 },
);
async function loadRootPages(catalogType: "normal" | "bc"): Promise<RootTab[]> {
const pagesTable = catalogType === "bc" ? CatalogPagesBc : CatalogPages;
const rootRaw = await db
@@ -78,7 +85,7 @@ export default async function CatalogPagesPage({
const catalogType = sp.catalog === "bc" ? "bc" : "normal";
const [totals, rootPages] = await Promise.all([
loadTotals(catalogType),
getCachedTotals(catalogType),
loadRootPages(catalogType),
]);