mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-10-27 02:16:23 -04:00
Reads no longer live in "use server" files (which made them public
endpoints). /notes stats come from one cached query pair rendered on the
server; the post page comment count streams in as a dynamic hole.
revalidateTag("views"/"comments") now invalidates the cached stats.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
15 lines
488 B
TypeScript
15 lines
488 B
TypeScript
import NumberFlow from "@number-flow/react";
|
|
import { connection } from "next/server";
|
|
|
|
import { getCommentCount } from "@/lib/data/comments";
|
|
|
|
const CommentCount = async ({ slug }: { slug: string }) => {
|
|
// render per-request (as a dynamic hole) so the post's static shell keeps its long cache lifetime
|
|
await connection();
|
|
const count = await getCommentCount(slug);
|
|
|
|
return <NumberFlow locales={process.env.NEXT_PUBLIC_SITE_LOCALE} value={count} />;
|
|
};
|
|
|
|
export { CommentCount };
|