Skip to content

Update revalidatePath.mdx #80675

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

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from
Open

Update revalidatePath.mdx #80675

wants to merge 2 commits into from

Conversation

MartSurv
Copy link

Hello,

After spending quite some time trying to understand why the revalidatePath wasn't working, I have noticed that in order for it to work, the path must include the trailing slash. For example:

I have noticed that in order for revalidatePath to work, the path must be exactly the same as it appears in the browser bar (including the trailing slash).

For example: http://localhost:300/test -> revalidatePath('/test/')
@ijjk ijjk added the Documentation Related to Next.js' official documentation. label Jun 19, 2025
@ijjk
Copy link
Member

ijjk commented Jun 19, 2025

Allow CI Workflow Run

  • approve CI run for commit: 958439c

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

1 similar comment
@ijjk
Copy link
Member

ijjk commented Jun 19, 2025

Allow CI Workflow Run

  • approve CI run for commit: 958439c

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@@ -30,7 +30,7 @@ revalidatePath(path: string, type?: 'page' | 'layout'): void;

```ts
import { revalidatePath } from 'next/cache'
revalidatePath('/blog/post-1')
revalidatePath('/blog/post-1/')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a deployment/repro where you are seeing this? We don't add the trailing slash to the tags generated so shouldn't be the case when calling revalidatePath either.

x-ref:

derivedTags.push(curPathname)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Related to Next.js' official documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants