Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
fba4609b
Commit
fba4609b
authored
Oct 09, 2025
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify delay logic in patch-fetch
parent
9da7a501
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
35 deletions
+6
-35
errors.json
packages/next/errors.json
+1
-2
patch-fetch.ts
packages/next/src/server/lib/patch-fetch.ts
+5
-33
No files found.
packages/next/errors.json
View file @
fba4609b
...
...
@@ -868,6 +868,5 @@
"867"
:
"The %s
\"
%s
\"
must export a %s or a
\\
`default
\\
` function"
,
"868"
:
"No reference found for param: %s in reference: %s"
,
"869"
:
"No reference found for segment: %s with reference: %s"
,
"870"
:
"`pipelineInSequentialTasks` should not be called in edge runtime."
,
"871"
:
"dynamicInDevStagedRendering should only be used in development mode and when Cache Components is enabled."
"870"
:
"`pipelineInSequentialTasks` should not be called in edge runtime."
}
packages/next/src/server/lib/patch-fetch.ts
View file @
fba4609b
...
...
@@ -17,7 +17,6 @@ import type { FetchMetric } from '../base-http'
import
{
createDedupeFetch
}
from
'./dedupe-fetch'
import
{
getCacheSignal
,
type
RequestStore
,
type
RevalidateStore
,
type
WorkUnitAsyncStorage
,
}
from
'../app-render/work-unit-async-storage.external'
...
...
@@ -30,7 +29,6 @@ import {
}
from
'../response-cache'
import
{
cloneResponse
}
from
'./clone-response'
import
type
{
IncrementalCache
}
from
'./incremental-cache'
import
{
InvariantError
}
from
'../../shared/lib/invariant-error'
const
isEdgeRuntime
=
process
.
env
.
NEXT_RUNTIME
===
'edge'
...
...
@@ -573,7 +571,7 @@ export function createPatchedFetcher(
cacheSignal
=
null
}
// TODO(restart-on-cache-miss): block dynamic when filling caches
await
dynamicInDevStagedRendering
(
workUnitStore
)
await
getTimeoutBoundary
(
)
}
break
case
'prerender-ppr'
:
...
...
@@ -698,7 +696,7 @@ export function createPatchedFetcher(
cacheSignal
=
null
}
// TODO(restart-on-cache-miss): block dynamic when filling caches
await
dynamicInDevStagedRendering
(
workUnitStore
)
await
getTimeoutBoundary
(
)
}
break
case
'prerender-ppr'
:
...
...
@@ -968,7 +966,7 @@ export function createPatchedFetcher(
process
.
env
.
NODE_ENV
===
'development'
&&
isStagedRenderingInDev
)
{
await
dynamicInDevStagedRendering
(
workUnitStore
)
await
getTimeoutBoundary
(
)
}
break
case
'prerender-ppr'
:
...
...
@@ -1089,7 +1087,7 @@ export function createPatchedFetcher(
cacheSignal
=
null
}
// TODO(restart-on-cache-miss): block dynamic when filling caches
await
dynamicInDevStagedRendering
(
workUnitStore
)
await
getTimeoutBoundary
(
)
}
break
case
'prerender-ppr'
:
...
...
@@ -1134,7 +1132,7 @@ export function createPatchedFetcher(
isStagedRenderingInDev
)
{
// TODO(restart-on-cache-miss): block dynamic when filling caches
await
dynamicInDevStagedRendering
(
workUnitStore
)
await
getTimeoutBoundary
(
)
}
break
case
'cache'
:
...
...
@@ -1286,29 +1284,3 @@ function getTimeoutBoundary() {
}
return
currentTimeoutBoundary
}
async
function
dynamicInDevStagedRendering
(
requestStore
:
RequestStore
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
&&
process
.
env
.
__NEXT_CACHE_COMPONENTS
)
{
if
(
requestStore
.
cacheSignal
)
{
// TODO(restart-on-cache-miss): block dynamic more effectively.
// Ideally, we'd hang here -- if the render acts as a warmup, there's no need to execute dynamic requests.
// But we can *only* hang if the render ends up being a warmup and gets discarded --
// if it's used as is, we have to resolve the fetch eventually.
// This coordination mechanism will be implemented in a follow-up,
// for now it's enough to delay.
await
getTimeoutBoundary
()
await
getTimeoutBoundary
()
}
else
{
// We don't have a cacheSignal, so this is the final (restarted) render.
// Don't block, but delay to prevent this from resolving in the static stage.
await
getTimeoutBoundary
()
}
}
else
{
throw
new
InvariantError
(
'dynamicInDevStagedRendering should only be used in development mode and when Cache Components is enabled.'
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment