Unverified Commit 483ebc25 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Skip copying signal field for revalidate (#54533)

This ensures we don't pass through the signal field when revalidating a
fetch as that can be delayed and we don't want to abort the
revalidation.

Closes: https://github.com/vercel/next.js/issues/54045
parent 9a2a3496
...@@ -306,6 +306,17 @@ export function patchFetch({ ...@@ -306,6 +306,17 @@ export function patchFetch({
console.error(`Failed to generate cache key for`, input) console.error(`Failed to generate cache key for`, input)
} }
} }
const fetchIdx = staticGenerationStore.nextFetchId ?? 1
staticGenerationStore.nextFetchId = fetchIdx + 1
const normalizedRevalidate =
typeof revalidate !== 'number' ? CACHE_ONE_YEAR : revalidate
const doOriginalFetch = async (
isStale?: boolean,
cacheReasonOverride?: string
) => {
const requestInputFields = [ const requestInputFields = [
'cache', 'cache',
'credentials', 'credentials',
...@@ -317,9 +328,11 @@ export function patchFetch({ ...@@ -317,9 +328,11 @@ export function patchFetch({
'redirect', 'redirect',
'referrer', 'referrer',
'referrerPolicy', 'referrerPolicy',
'signal',
'window', 'window',
'duplex', 'duplex',
// don't pass through signal when revalidating
...(isStale ? [] : ['signal']),
] ]
if (isRequestInput) { if (isRequestInput) {
...@@ -344,16 +357,6 @@ export function patchFetch({ ...@@ -344,16 +357,6 @@ export function patchFetch({
} }
} }
const fetchIdx = staticGenerationStore.nextFetchId ?? 1
staticGenerationStore.nextFetchId = fetchIdx + 1
const normalizedRevalidate =
typeof revalidate !== 'number' ? CACHE_ONE_YEAR : revalidate
const doOriginalFetch = async (
isStale?: boolean,
cacheReasonOverride?: string
) => {
// add metadata to init without editing the original // add metadata to init without editing the original
const clonedInit = { const clonedInit = {
...init, ...init,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment