Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for revalidatePath fix #55083

Merged
merged 10 commits into from
Sep 12, 2023
12 changes: 8 additions & 4 deletions docs/02-app/02-api-reference/04-functions/revalidatePath.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ description: API Reference for the revalidatePath function.
> **Good to know**:
>
> - `revalidatePath` is available in both [Node.js and Edge runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes).
> - `revalidatePath` will revalidate _all segments_ under a dynamic route segment. For example, if you have a dynamic segment `/product/[id]` and you call `revalidatePath('/product/[id]')`, then all segments under `/product/[id]` will be revalidated as requested.
> - `revalidatePath` only invalidates the cache when the 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.
> - `revalidatePath` can invalidate by:
ijjk marked this conversation as resolved.
Show resolved Hide resolved
> - URL `revalidatePath('/blog/post-1')` invalidates just this specific URL
> - page path `revalidatePath('/blog/[slug]', 'page')` invalidates the page regardless of exact URL
> - from a layout `revalidatePath('/blog/[slug]', 'layout')` invalidates any paths that include this layout
> - `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.

## Parameters

```tsx
revalidatePath(path: string): void;
revalidatePath(path: string, type?: 'page' | 'layout'): void;
```

- `path`: A string representing the filesystem path associated with the data you want to revalidate. This is **not** the literal route segment (e.g. `/product/123`) but instead the path on the filesystem (e.g. `/product/[id]`).
- `path`: A string representing the filesystem path associated with the data you want to revalidate. This is the literal route segment (e.g. `/product/123`) not the path on the filesystem `/product/[slug]/page`.
- `type`: An optional string of either 'page' or 'layout' to change behavior of what type of path is being revalidated.
ijjk marked this conversation as resolved.
Show resolved Hide resolved

## Returns

Expand Down
Loading