-
Notifications
You must be signed in to change notification settings - Fork 23
fix(docs): replace revalidateTag with invalidateByTag in revalidate route #4642
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
base: app
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ import { getEnv, waitUntil } from "@vercel/functions"; | |
| import { kv } from "@vercel/kv"; | ||
| import { mapValues } from "es-toolkit/object"; | ||
| import { escapeRegExp } from "es-toolkit/string"; | ||
| import { revalidatePath, revalidateTag } from "next/cache"; | ||
| import { invalidateByTag, revalidatePath } from "next/cache"; | ||
| import { type NextRequest, NextResponse } from "next/server"; | ||
| import { UnreachableCaseError } from "ts-essentials"; | ||
| import { getFaiClient } from "@/getFaiClient"; | ||
|
|
@@ -63,7 +63,7 @@ export async function GET( | |
| const start = performance.now(); | ||
|
|
||
| const { host, domain } = await props.params; | ||
| revalidateTag(domain); | ||
| invalidateByTag(domain); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Calling non-existent 🔍 Detailed AnalysisThe application attempts to import and call 💡 Suggested FixReplace 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
| // delay to ensure invalidation propagates before cache is accessed | ||
| await new Promise((resolve) => setTimeout(resolve, 500)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function
invalidateByTagdoes not exist in Next.js 15.5.4's cache API. The correct function isrevalidateTag, which is still being used in similar route files across the codebase.View Details
📝 Patch Details
Analysis
Invalid function
invalidateByTagimported from Next.js cache APIWhat fails: Route
packages/fern-docs/bundle/src/app/[host]/[domain]/api/fern-docs/revalidate/route.tsimportsinvalidateByTagfromnext/cache, but this function doesn't exist in Next.js 15.5.4How to reproduce:
Result: TypeScript compilation error:
'"next/cache"' has no exported member named 'invalidateByTag'. Did you mean 'revalidateTag'?Runtime error when endpoint is called:invalidateByTag is not a functionExpected: Should use
revalidateTagfunction which is the correct Next.js cache invalidation API per Next.js documentation and matches usage in other route files in the codebase