Files
jarv.is/components/comment-count.tsx
jakeandClaude Sonnet 5.5 6d255ce822 refactor: move read queries into server-only lib/data and render post stats on the server
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>
2026-10-03 08:40:14 -04:00

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 };