File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed
renders/getGraphQLPageQuery Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11import { notFound } from "next/navigation" ;
22import { getDotCMSPage } from "@/util/getDotCMSPage" ;
3+
4+ // ISR: Revalidate pages every 60 seconds
5+ export const revalidate = 60 ;
36import { getSideNav } from "@/services/docs/getSideNav"
47import { isGitHubDoc , getGitHubConfig } from "@/config/github-docs" ;
58import { getDocsContentWithGitHub } from "@/services/docs/getGitHubContent" ;
Original file line number Diff line number Diff line change @@ -47,9 +47,9 @@ export async function getNavSections(options: FetchOptions = {}): Promise<NavSec
4747 const res = await fetch ( url , {
4848 method : 'GET' ,
4949 headers : Config . Headers ,
50- // Ensure server-side request cache doesn't interfere; we manage our own cache
51- cache : 'no-store' ,
52- next : { revalidate : 0 } ,
50+ // Use Next.js data cache with revalidation (works in serverless)
51+ // In-memory navCache above provides request-level deduplication
52+ next : { revalidate : ttlSeconds } ,
5353 } ) ;
5454
5555 if ( ! res . ok ) {
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ export const getGraphQLPageQuery = async ({
9494 method : 'POST' ,
9595 headers : Config . Headers ,
9696 body : JSON . stringify ( { query } ) ,
97- cache : 'no-cache'
97+ next : { revalidate : 60 } // ISR: revalidate every 60 seconds
9898 } ) ,
9999 'getGraphQLPageQuery'
100100 ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ export const client = createDotCMSClient({
1515 authToken : authToken ,
1616 siteId : "173aff42881a55a562cec436180999cf" ,
1717 requestOptions : {
18- // In production you might want to deal with this differently
19- cache : "no-cache" ,
18+ next : { revalidate : 60 } // ISR: revalidate cached data every 60 seconds
2019 }
2120} ) ;
You can’t perform that action at this time.
0 commit comments