← Back to Fixes
Next.js revalidatePath Not Working: Production Fix Guide for App Router
Fix stale UI after mutations by aligning revalidatePath/revalidateTag with data boundaries and cache strategy.
Tweetable Insight#
If the wrong cache key is invalidated, revalidatePath is a no-op in practice.
One-Sentence Definition#
revalidatePath fails when invalidation targets do not match where the stale fetch result is cached.
Production Risk Warning#
Users can see stale account state after billing or permission changes.
Problem (Search Intent First)#
Mutation succeeds but page still shows old data.
Why It Happens#
Path/tag mismatch, static boundaries, or user-specific data cached in shared routes.
Production-Grade Fix#
Invalidate the exact path/tag bound to your fetch and force dynamic rendering for user-scoped pages.
Copy-Paste Solution#
ts
import { revalidatePath } from "next/cache";
export async function updateProfile(input: FormData) {
// db mutation
revalidatePath("/dashboard/settings");
}
Edge Cases#
- Client mutation + server render can race without explicit refresh.
- Multi-tenant routes need tenant-specific invalidation strategy.