From 74c0c5e13e32d9e75f5f825a6a18fe606854680c Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Thu, 30 Nov 2023 19:52:19 +0100 Subject: [PATCH] fix: also revalidate the pages themselves --- app/[locale]/[[...path]]/page.tsx | 7 ++++++- app/[locale]/next-data/blog-data/[category]/route.ts | 4 ++-- app/[locale]/next-data/release-data/route.ts | 4 ++-- next.constants.mjs | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/[locale]/[[...path]]/page.tsx b/app/[locale]/[[...path]]/page.tsx index fea31f53c0565..ef38907098b8c 100644 --- a/app/[locale]/[[...path]]/page.tsx +++ b/app/[locale]/[[...path]]/page.tsx @@ -5,7 +5,7 @@ import type { FC } from 'react'; import { setClientContext } from '@/client-context'; import { MDXRenderer } from '@/components/mdxRenderer'; import { WithLayout } from '@/components/withLayout'; -import { ENABLE_STATIC_EXPORT } from '@/next.constants.mjs'; +import { ENABLE_STATIC_EXPORT, VERCEL_REVALIDATE } from '@/next.constants.mjs'; import { DEFAULT_VIEWPORT } from '@/next.dynamic.constants.mjs'; import { dynamicRouter } from '@/next.dynamic.mjs'; import { availableLocaleCodes, defaultLocale } from '@/next.locales.mjs'; @@ -124,4 +124,9 @@ export const dynamicParams = true; // @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic export const dynamic = 'error'; +// Ensures that this endpoint is invalidated and re-executed every X minutes +// so that when new deployments happen, the data is refreshed +// @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate +export const revalidate = VERCEL_REVALIDATE; + export default getPage; diff --git a/app/[locale]/next-data/blog-data/[category]/route.ts b/app/[locale]/next-data/blog-data/[category]/route.ts index b0cd326bec155..5ccf68aad6d9f 100644 --- a/app/[locale]/next-data/blog-data/[category]/route.ts +++ b/app/[locale]/next-data/blog-data/[category]/route.ts @@ -1,5 +1,5 @@ import provideBlogData from '@/next-data/providers/blogData'; -import { VERCEL_EVALIDATE_TIME } from '@/next.constants.mjs'; +import { VERCEL_REVALIDATE } from '@/next.constants.mjs'; import { defaultLocale } from '@/next.locales.mjs'; // We only support fetching these pages from the /en/ locale code @@ -45,4 +45,4 @@ export const dynamic = 'error'; // Ensures that this endpoint is invalidated and re-executed every X minutes // so that when new deployments happen, the data is refreshed // @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate -export const revalidate = VERCEL_EVALIDATE_TIME; +export const revalidate = VERCEL_REVALIDATE; diff --git a/app/[locale]/next-data/release-data/route.ts b/app/[locale]/next-data/release-data/route.ts index 0bd37dd5ab8ba..f0acdbb9bda25 100644 --- a/app/[locale]/next-data/release-data/route.ts +++ b/app/[locale]/next-data/release-data/route.ts @@ -1,5 +1,5 @@ import provideReleaseData from '@/next-data/providers/releaseData'; -import { VERCEL_EVALIDATE_TIME } from '@/next.constants.mjs'; +import { VERCEL_REVALIDATE } from '@/next.constants.mjs'; import { defaultLocale } from '@/next.locales.mjs'; // We only support fetching these pages from the /en/ locale code @@ -30,4 +30,4 @@ export const dynamic = 'error'; // Ensures that this endpoint is invalidated and re-executed every X minutes // so that when new deployments happen, the data is refreshed // @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate -export const revalidate = VERCEL_EVALIDATE_TIME; +export const revalidate = VERCEL_REVALIDATE; diff --git a/next.constants.mjs b/next.constants.mjs index 934aee0c1b963..abf00f93c3de3 100644 --- a/next.constants.mjs +++ b/next.constants.mjs @@ -27,7 +27,7 @@ export const VERCEL_ENV = process.env.NEXT_PUBLIC_VERCEL_ENV || undefined; * * Note that this is a custom Environment Variable that can be defined by us when necessary */ -export const VERCEL_EVALIDATE_TIME = Number( +export const VERCEL_REVALIDATE = Number( process.env.NEXT_PUBLIC_VERCEL_REVALIDATE_TIME || 300 );