refactor: use "use cache: remote" for request-time reads and updateTag/refresh for mutations

- Replace `"use cache"` with `"use cache: remote"` on functions that run inside dynamic holes (`getContributions`, `getRepos`, `getPostStats`, `getCachedComments`) so entries are shared across server instances
- Switch comment and view server actions from `revalidatePath`/`revalidateTag` to `updateTag` + `refresh` for read-your-writes invalidation
- Extract a `commentsTag(pageSlug)` helper so each page's comment cache is expired independently instead of blowing the whole "comments" tag
- Refactor `getComments` to delegate to a cached inner function that throws on failure (so errors are never cached); `getCommentCount` now reuses that cache entry instead of issuing a separate COUNT query
- Drop `lib/data/views.ts` (`getAllViewCounts`) — the `/api/hits` route now calls `getPostStats()` instead
- Remove `revalidateTag("views")` from `incrementViews`; view counts in `getPostStats` are allowed to lag by a cache TTL
- Remove the `Suspense`/`Skeleton` wrapper on the projects page since `getContributions` is now a remote-cached call
This commit is contained in:
jake committed 2026-10-03 09:50:06 -04:00
1 parent 373f1cfc75
commit d3b2d07de7
10 files changed
+75 -96

No files matched your search

-3
View File
@@ -36,9 +36,6 @@ const nextConfig = {
...(process.env.NEXT_PUBLIC_ONION_DOMAIN ? [process.env.NEXT_PUBLIC_ONION_DOMAIN] : []),
],
},
staleTimes: {
dynamic: 0, // disable client-side router cache for dynamic pages
},
},
headers: async () => [
// https://community.torproject.org/onion-services/advanced/onion-location/