Path revalidation
What you need to know
Path revalidation targets a route or route pattern. Tag revalidation targets cached data relationships that may be used by several routes. Choose the scope that corresponds to the change.
By the end, you can: identify affected route; explain path versus shared tag.
Target a concrete page or dynamic page pattern
import { revalidatePath } from 'next/cache';// Partial post-commit server helper, choose one scope.export function invalidateDetail(scope: 'one' | 'all') { if (scope === 'one') revalidatePath('/catalog/fern'); else revalidatePath('/catalog/[slug]', 'page');}Expected behavior: The first branch selects the concrete detail URL; the second targets pages matching the segment pattern, not a wildcard string.
How it works
Consider /catalog, /catalog/fern and /home, all reading some public catalog data. Invalidating the detail page does not mean every reader of the shared catalog tag has been refreshed. A concrete URL such as /catalog/fern addresses a particular page; a dynamic segment pattern such as /catalog/[slug] requires a page or layout type argument. Layout invalidation affects the relevant nested route scope. In a Route Handler the targeted path is marked for revalidation on a later visit; an action can update the currently viewed affected route as part of its response. The documented client-side navigation effects have evolved, so do not depend on broad refresh behavior across all previously visited pages. Choose a narrow path when route output alone changes and tags when the underlying public data is shared. If both scopes matter, use both deliberately after an authorized change.
Trace readers of one shared tag
/catalog -> catalog/catalog/fern -> catalog, book:fern/home -> catalogChange: Fern titleDecision: invalidate catalog and book:fern dependencies; narrow route invalidation if route-specific output also changedExpected behavior: The dependency graph explains why invalidating only /catalog/fern might leave other readers stale.
Common mistake
Do not interpolate an arbitrary user-supplied path into a public invalidation handler. Do not treat path revalidation as a purge of all cached data used anywhere else.
Practice and verification
Given a detail layout and two unrelated pages using the same catalog tag, predict affected readers under path-only and tag-only invalidation. Verify in the later integrated app by reading each page after a controlled revision change.
Scope: App Router, proposed Next.js 16.x and React 19, Cache Components enabled in a separate fixture. Framework snippets are staged and not executed; local pure models are not framework evidence. Exact patched dependencies and platform contracts are pending.
Further reading: Path · Revalidate Tag · Update Tag