refactor(web-next): thin app pages that just render feature components

Pages import feature server components and pass only route-derived
props (slug, id). All data fetching, prefetch, and hydration is owned
by the feature's .server.tsx component.
This commit is contained in:
danijel-lf
2026-05-26 15:59:01 +02:00
parent 7ef0411ffa
commit ee45bfe932
3 changed files with 18 additions and 78 deletions

View File

@@ -1,35 +1,12 @@
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
import { appRouter } from "@repo/core-api";
import { getQueryClient } from "@repo/core-trpc";
import { PageContent } from "@repo/marketing-pages/ui";
import { bindAll } from "../../server/bind-production";
export default async function AboutPage() {
const caller = appRouter.createCaller({});
const queryClient = getQueryClient();
const page = await caller.marketingPages.pageBySlug({ slug: "about" });
queryClient.setQueryData(
["marketingPages", "pageBySlug", { input: { slug: "about" } }],
page,
);
if (!page) {
return (
<main className="mx-auto max-w-3xl px-6 py-8">
<h1 className="text-3xl font-bold text-foreground">About</h1>
<p className="mt-2 text-muted-foreground">
This page hasn&apos;t been published yet.
</p>
</main>
);
}
await bindAll();
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<main className="px-6 py-8">
<PageContent slug="about" />
</main>
</HydrationBoundary>
<main className="px-6 py-8">
<PageContent slug="about" />
</main>
);
}