Skip to content

Commit

Permalink
fix revalidateTag import (#51005)
Browse files Browse the repository at this point in the history
This PR fixes the erroneous `revalidateTag` import on certain examples.
It was imported from `next/server`, but should be imported from
`next/cache` instead.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
  • Loading branch information
kvnang and delbaoliveira committed Jun 9, 2023
1 parent 8484a6b commit e5b88ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/02-app/02-api-reference/04-functions/revalidateTag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ description: API Reference for the revalidateTag function.
`revalidateTag` allows you to revalidate data associated with a specific cache tag. This is useful for scenarios where you want to update your cached data without waiting for a revalidation period to expire.

```tsx filename="app/api/revalidate/route.ts" switcher
import { NextRequest, NextResponse, revalidateTag } from 'next/server'
import { NextRequest, NextResponse } from 'next/server'
import { revalidateTag } from 'next/cache'

export async function GET(request: NextRequest) {
const tag = request.nextUrl.searchParams.get('tag')
Expand All @@ -16,7 +17,8 @@ export async function GET(request: NextRequest) {
```

```jsx filename="app/api/revalidate/route.js" switcher
import { NextResponse, revalidateTag } from 'next/server'
import { NextResponse } from 'next/server'
import { revalidateTag } from 'next/cache'

export async function GET(request) {
const tag = request.nextUrl.searchParams.get('tag')
Expand Down

0 comments on commit e5b88ca

Please sign in to comment.