Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation Fix: Correct
cacheTag
Function Usage (#71912)
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## What? ### Documentation Fix: Correct `cacheTag` Function Usage **Issue**: The [current documentation](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#notes) incorrectly states that `cacheTag` accepts an array of tags. However, the [source code](https://github.com/vercel/next.js/blob/ca5f29d81b011c3a01e2372118b29836f1df0fa7/packages/next/src/server/use-cache/cache-tag.ts#L4C1-L4C52) implementation uses rest parameters (`...tags: string[]`), expecting individual string arguments rather than an array. **Changes**: Updated the "Notes" section to reflect the function's correct usage: ## Why? This change: 1. Aligns with the actual implementation in the source code 2. Prevents TypeScript errors when users follow the documentation 3. Provides clearer guidance on using the function with both direct arguments and arrays (using the spread operator) The current documentation might lead developers to encounter the TypeScript error: > "Argument of type 'string[]' is not assignable to parameter of type 'string'" ## Related Fixes #71901 Co-authored-by: Delba de Oliveira <[email protected]>
- Loading branch information