Skip to content

Commit

Permalink
fix: also revalidate the pages themselves
Browse files Browse the repository at this point in the history
  • Loading branch information
ovflowd committed Nov 30, 2023
1 parent 80af3e1 commit 74c0c5e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion app/[locale]/[[...path]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
4 changes: 2 additions & 2 deletions app/[locale]/next-data/blog-data/[category]/route.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
4 changes: 2 additions & 2 deletions app/[locale]/next-data/release-data/route.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
2 changes: 1 addition & 1 deletion next.constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down

0 comments on commit 74c0c5e

Please sign in to comment.