mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-19 08:15:28 -04:00
fix: don't pre-render view and comment count components
- Introduced a new PostStats component to handle view and comment counts, replacing the previous async implementation with a client-side approach. - Updated CommentCount component to use client-side state management for fetching comment counts. - Removed unnecessary caching logic from view and comment fetching functions. - Simplified date formatting by moving it inline, enhancing performance and readability.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getViewCounts } from "@/lib/views";
|
||||
import { getAllViewCounts } from "@/lib/server/views";
|
||||
|
||||
export const GET = async (): Promise<
|
||||
NextResponse<{
|
||||
@@ -13,7 +13,7 @@ export const GET = async (): Promise<
|
||||
}>
|
||||
> => {
|
||||
// note: while hits have been renamed to views in most places, this API shouldn't change due to it being snapshotted
|
||||
const views = await getViewCounts();
|
||||
const views = await getAllViewCounts();
|
||||
|
||||
const total = {
|
||||
hits: Object.values(views).reduce((acc, curr) => acc + curr, 0),
|
||||
|
||||
Reference in New Issue
Block a user