From 3a9efb8aed72ec314fbc6c449bec8c4c3eb0f20e Mon Sep 17 00:00:00 2001 From: conico974 Date: Tue, 5 May 2026 14:39:34 +0200 Subject: [PATCH] bust revision page markdown (#4235) --- .../customWorkers/defaultWrangler.jsonc | 6 ++---- .../incrementalCache/incrementalCache.ts | 1 - packages/gitbook/src/lib/data/api.ts | 21 +++++++++++++------ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc b/packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc index 618191d00..9da8c3f6a 100644 --- a/packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc +++ b/packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc @@ -92,8 +92,7 @@ }, "staging": { "vars": { - "OPEN_NEXT_REQUEST_ID_HEADER": "true", - "NEXT_PRIVATE_DEBUG_CACHE": "true" + "OPEN_NEXT_REQUEST_ID_HEADER": "true" }, "r2_buckets": [ { @@ -137,8 +136,7 @@ // This is a bit misleading, but it means that we can have 500 concurrent revalidations // This means that we'll have up to 100 durable objects instance running at the same time "MAX_REVALIDATE_CONCURRENCY": "100", - "OPEN_NEXT_REQUEST_ID_HEADER": "true", - "NEXT_PRIVATE_DEBUG_CACHE": "true" + "OPEN_NEXT_REQUEST_ID_HEADER": "true" }, "r2_buckets": [ { diff --git a/packages/gitbook/openNext/incrementalCache/incrementalCache.ts b/packages/gitbook/openNext/incrementalCache/incrementalCache.ts index 49dde5aac..11c0f8977 100644 --- a/packages/gitbook/openNext/incrementalCache/incrementalCache.ts +++ b/packages/gitbook/openNext/incrementalCache/incrementalCache.ts @@ -29,7 +29,6 @@ export class GitbookIncrementalCache implements IncrementalCache { cacheType?: CacheType ): Promise> | null> { const cacheKey = this.getR2Key(key, cacheType); - console.log(`[GitbookIncrementalCache] Getting cache for key: ${cacheKey}`, key, cacheType); const r2 = getCloudflareContext().env[BINDING_NAME]; if (!r2) throw new Error('No R2 bucket'); diff --git a/packages/gitbook/src/lib/data/api.ts b/packages/gitbook/src/lib/data/api.ts index 7025bc6e2..7544815f5 100644 --- a/packages/gitbook/src/lib/data/api.ts +++ b/packages/gitbook/src/lib/data/api.ts @@ -87,11 +87,18 @@ export function createDataFetcher( }); }, getRevisionPageMarkdown(params) { - return getRevisionPageMarkdown(input, { - spaceId: params.spaceId, - revisionId: params.revisionId, - pageId: params.pageId, - }); + return getRevisionPageMarkdown( + input, + { + spaceId: params.spaceId, + revisionId: params.revisionId, + pageId: params.pageId, + }, + // We pass the name of the function to distinguish between cache entries + // By default Next only uses the arguments, the filename and the position of the function inside the file + // By adding a dummy argument with the function name, we can change the order without breaking anything + 'getRevisionPageMarkdown' + ); }, getRevisionPageDocument(params) { return getRevisionPageDocument( @@ -318,7 +325,9 @@ const getRevision = cache( const getRevisionPageMarkdown = cache( async ( input: DataFetcherInput, - params: { spaceId: string; revisionId: string; pageId: string } + params: { spaceId: string; revisionId: string; pageId: string }, + // used only to bust the cache + _functionName: string ) => { 'use cache: remote'; return wrapCacheDataFetcherError(async () => {