From 750699a6b9e38bbbfbd1d48e6bb208bdf37dcc4e Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Fri, 20 Sep 2024 13:57:45 +0200 Subject: [PATCH] docs: fix the signature of CacheHandler#revalidateTag --- .../01-building-your-application/10-deploying/index.mdx | 6 ++++-- .../05-next-config-js/incrementalCacheHandlerPath.mdx | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/02-app/01-building-your-application/10-deploying/index.mdx b/docs/02-app/01-building-your-application/10-deploying/index.mdx index 2f410be3cba22..ed1944aa9fca3 100644 --- a/docs/02-app/01-building-your-application/10-deploying/index.mdx +++ b/docs/02-app/01-building-your-application/10-deploying/index.mdx @@ -175,11 +175,13 @@ module.exports = class CacheHandler { }) } - async revalidateTag(tag) { + async revalidateTag(tags) { + // tags is either a string or an array of strings + tags = [tags].flat() // Iterate over all entries in the cache for (let [key, value] of cache) { // If the value's tags include the specified tag, delete this entry - if (value.tags.includes(tag)) { + if (value.tags.some((tag) => tags.include(tag))) { cache.delete(key) } } diff --git a/docs/02-app/02-api-reference/05-next-config-js/incrementalCacheHandlerPath.mdx b/docs/02-app/02-api-reference/05-next-config-js/incrementalCacheHandlerPath.mdx index d134f44024649..ce3fc4abd16cf 100644 --- a/docs/02-app/02-api-reference/05-next-config-js/incrementalCacheHandlerPath.mdx +++ b/docs/02-app/02-api-reference/05-next-config-js/incrementalCacheHandlerPath.mdx @@ -39,9 +39,9 @@ Returns `Promise`. ### `revalidateTag()` -| Parameter | Type | Description | -| --------- | -------- | ---------------------------- | -| `tag` | `string` | The cache tag to revalidate. | +| Parameter | Type | Description | +| --------- | ---------------------- | ----------------------------- | +| `tag` | `string` or `string[]` | The cache tags to revalidate. | Returns `Promise`. Learn more about [revalidating data](/docs/app/building-your-application/data-fetching/caching-and-revalidating) or the [`revalidateTag()`](/docs/app/api-reference/functions/revalidateTag) function.