#revalidatePath
1 messages · Page 1 of 1 (latest)
Hi @proud geyser. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The revalidatePath function in Next.js allows you to manually revalidate data and re-render the route segments below a specific path in a single operation. It is used to purge cached data on-demand for a specific path. This function is available in both Node.js and Edge runtimes.
Here is an example of how to use revalidatePath in a client component:
import { revalidatePath } from 'next/cache'
revalidatePath('/', 'layout')
In this example, the revalidatePath function will purge the Client-side Router Cache, and revalidate the Data Cache on the next page visit.
Please note that revalidatePath only invalidates the cache when the included path is next visited. This means calling revalidatePath with a dynamic route segment will not immediately trigger many revalidations at once. The invalidation only happens when the path is next visited.
Also, currently, revalidatePath invalidates all the routes in the client-side Router Cache. This behavior is temporary and will be updated in the future to apply only to the specific path.