From aedf05fe1db9f2bfd08151b43a5402753947e927 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 10 Oct 2024 14:29:08 -0400 Subject: [PATCH] fix type --- packages/next/src/server/lib/patch-fetch.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/next/src/server/lib/patch-fetch.ts b/packages/next/src/server/lib/patch-fetch.ts index 4264f9021f0f2..63a4dccd74920 100644 --- a/packages/next/src/server/lib/patch-fetch.ts +++ b/packages/next/src/server/lib/patch-fetch.ts @@ -741,13 +741,15 @@ function createPatchedFetcher( const nextRevalidate = pendingResponse .then((res) => res.clone()) .finally(() => { - // If the pending revalidate is not present in the store, then - // we have nothing to delete. - if (!staticGenerationStore.pendingRevalidates?.[cacheKey]) { - return - } + if (cacheKey) { + // If the pending revalidate is not present in the store, then + // we have nothing to delete. + if (!staticGenerationStore.pendingRevalidates?.[cacheKey]) { + return + } - delete staticGenerationStore.pendingRevalidates[cacheKey] + delete staticGenerationStore.pendingRevalidates[cacheKey] + } }) // Attach the empty catch here so we don't get a "unhandled promise