From 6acecc52bdde579c1e3cdea60cb59558ce82ad26 Mon Sep 17 00:00:00 2001 From: VectoDE Date: Sat, 8 Nov 2025 14:52:52 +0100 Subject: [PATCH] Ensure dashboard content updates render immediately --- app/page.tsx | 2 ++ app/projects/[id]/page.tsx | 2 ++ components/certificates-showcase.tsx | 6 ++---- components/skills-showcase.tsx | 6 ++---- lib/certificates.ts | 4 ++++ lib/engagement.ts | 5 +++++ lib/projects.ts | 6 ++++++ lib/skills.ts | 5 +++++ 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 29627b6..63265e5 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -49,6 +49,8 @@ export const metadata: Metadata = { }, } +export const revalidate = 0 + export default async function Home() { const engagementHighlights = await getEngagementHighlights() const heroStats = [ diff --git a/app/projects/[id]/page.tsx b/app/projects/[id]/page.tsx index 443c4e4..1a4d176 100644 --- a/app/projects/[id]/page.tsx +++ b/app/projects/[id]/page.tsx @@ -24,6 +24,8 @@ interface ProjectPageProps { }> } +export const revalidate = 0 + export async function generateMetadata({ params }: ProjectPageProps) { const { id } = await params if (!id) { diff --git a/components/certificates-showcase.tsx b/components/certificates-showcase.tsx index b2b58f8..365b4ca 100644 --- a/components/certificates-showcase.tsx +++ b/components/certificates-showcase.tsx @@ -1,4 +1,4 @@ -import { Suspense, cache } from "react" +import { Suspense } from "react" import Link from "next/link" import { ExternalLink, GraduationCap } from "lucide-react" @@ -15,10 +15,8 @@ import { getAllCertificates } from "@/lib/certificates" import { CertificatesShowcaseSkeleton } from "@/components/skeletons/certificates-showcase-skeleton" import type { Certificate } from "@/types/database" -const getCachedCertificates = cache(getAllCertificates) - async function CertificatesShowcaseContent() { - const certificates = await getCachedCertificates(3) + const certificates = await getAllCertificates(3) return (
diff --git a/components/skills-showcase.tsx b/components/skills-showcase.tsx index 0554a50..4318801 100644 --- a/components/skills-showcase.tsx +++ b/components/skills-showcase.tsx @@ -1,5 +1,5 @@ import type React from "react" -import { Suspense, cache } from "react" +import { Suspense } from "react" import { Code2, Database, Server, Globe, Cpu, Layers } from "lucide-react" import * as LucideIcons from "lucide-react" import { getAllSkills } from "@/lib/skills" @@ -21,10 +21,8 @@ const categoryIcons: Record = { Other: Layers, } -const getCachedSkills = cache(getAllSkills) - async function SkillsContent() { - const skills = await getCachedSkills() + const skills = await getAllSkills() // Group skills by category const groupedSkills: Record = {} diff --git a/lib/certificates.ts b/lib/certificates.ts index 14cead4..b6e00c1 100644 --- a/lib/certificates.ts +++ b/lib/certificates.ts @@ -1,7 +1,10 @@ +import { unstable_noStore as noStore } from "next/cache" + import prisma from "@/lib/db" import type { Certificate } from "@/types/database" export async function getAllCertificates(limit?: number): Promise { + noStore() try { // Get the first user (assuming it's the portfolio owner) const user = await prisma.user.findFirst() @@ -34,6 +37,7 @@ export async function getAllCertificates(limit?: number): Promise } export async function getCertificateById(id: string): Promise { + noStore() try { const certificate = await prisma.certificate.findUnique({ where: { diff --git a/lib/engagement.ts b/lib/engagement.ts index a8a8b93..aece911 100644 --- a/lib/engagement.ts +++ b/lib/engagement.ts @@ -1,3 +1,5 @@ +import { unstable_noStore as noStore } from "next/cache" + import prisma from "@/lib/db" import type { EngagementHighlightProject, @@ -42,6 +44,7 @@ type RawProjectHighlight = { } export async function getProjectComments(projectId: string): Promise { + noStore() try { const comments = (await prisma.projectComment.findMany({ where: { projectId }, @@ -80,6 +83,7 @@ export async function getProjectComments(projectId: string): Promise { + noStore() try { const counts = (await prisma.projectReaction.groupBy({ by: ["type"], @@ -120,6 +124,7 @@ export async function getProjectReactionSummary(projectId: string): Promise { + noStore() try { const [totalComments, totalReactions, memberCount, topProjectsRaw, latestCommentRaw] = await Promise.all([ diff --git a/lib/projects.ts b/lib/projects.ts index 5a82183..3e2bc67 100644 --- a/lib/projects.ts +++ b/lib/projects.ts @@ -1,7 +1,10 @@ +import { unstable_noStore as noStore } from "next/cache" + import prisma from "@/lib/db" import type { Project } from "@/types/database" export async function getProjects() { + noStore() try { if (!prisma) { console.error("Prisma client is not initialized") @@ -22,6 +25,7 @@ export async function getProjects() { } export async function getAllProjects(): Promise { + noStore() try { if (!prisma) { console.error("Prisma client is not initialized") @@ -45,6 +49,7 @@ export async function getAllProjects(): Promise { } export async function getProjectById(id: string): Promise { + noStore() try { if (!prisma) { console.error("Prisma client is not initialized") @@ -68,6 +73,7 @@ export async function getProjectById(id: string): Promise { } export async function getFeaturedProjects(limit = 3): Promise { + noStore() try { if (!prisma) { console.error("Prisma client is not initialized") diff --git a/lib/skills.ts b/lib/skills.ts index 29d02b3..744de5a 100644 --- a/lib/skills.ts +++ b/lib/skills.ts @@ -1,7 +1,10 @@ +import { unstable_noStore as noStore } from "next/cache" + import prisma from "@/lib/db" import type { Skill } from "@/types/database" export async function getAllSkills(): Promise { + noStore() try { const skills = await prisma.skill.findMany({ orderBy: [{ category: "asc" }, { level: "desc" }, { name: "asc" }], @@ -15,6 +18,7 @@ export async function getAllSkills(): Promise { } export async function getSkillById(id: string): Promise { + noStore() try { const skill = await prisma.skill.findUnique({ where: { @@ -30,6 +34,7 @@ export async function getSkillById(id: string): Promise { } export async function getSkillsByCategory(category: string): Promise { + noStore() try { // Get the first user (assuming it's the portfolio owner) const user = await prisma.user.findFirst()