From 2129f9718ff0207438c5f69ff6ecc6c6272187f5 Mon Sep 17 00:00:00 2001 From: ginnoir Date: Wed, 6 May 2026 21:58:32 -0500 Subject: [PATCH] Fix revalidatePath during render in getDefaultDashboardSlug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a new user's first load, getDefaultDashboardSlug fell through to createDashboard("Home"), which calls revalidatePath("/"). That is illegal in a render context (page component → server action → revalidatePath). Inline the DB insert directly in the fallback and skip revalidatePath — the redirect that immediately follows is a fresh request, so no cache invalidation is needed here. Co-Authored-By: Claude Sonnet 4.6 --- src/app/d/actions.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/d/actions.ts b/src/app/d/actions.ts index d033b0c..1fc2b30 100644 --- a/src/app/d/actions.ts +++ b/src/app/d/actions.ts @@ -50,9 +50,13 @@ export async function getDefaultDashboardSlug(): Promise { .orderBy(asc(dashboards.position), asc(dashboards.createdAt)) .limit(1); if (first) return first.slug; - // No dashboards yet — create Home - await createDashboard("Home"); - return "home"; + // No dashboards yet — insert one directly without revalidatePath (we're in a + // render path; the redirect that follows is a fresh request anyway). + const slug = await uniqueSlug(user.id, "home"); + await db + .insert(dashboards) + .values({ userId: user.id, name: "Home", slug, isDefault: false, position: 0 }); + return slug; } export async function getDashboardBySlug(slug: string) {