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
b0724308
Commit
b0724308
authored
Oct 08, 2025
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a separate request store for the restarted render
parent
270a0616
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
app-render.tsx
packages/next/src/server/app-render/app-render.tsx
+13
-10
No files found.
packages/next/src/server/app-render/app-render.tsx
View file @
b0724308
...
@@ -1706,7 +1706,9 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1706,7 +1706,9 @@ async function renderToHTMLOrFlightImpl(
const
rootParams
=
getRootParams
(
loaderTree
,
ctx
.
getDynamicParamFromSegment
)
const
rootParams
=
getRootParams
(
loaderTree
,
ctx
.
getDynamicParamFromSegment
)
const
devValidatingFallbackParams
=
const
devValidatingFallbackParams
=
getRequestMeta
(
req
,
'devValidatingFallbackParams'
)
||
null
getRequestMeta
(
req
,
'devValidatingFallbackParams'
)
||
null
const
requestStore
=
createRequestStoreForRender
(
const
createRequestStore
=
createRequestStoreForRender
.
bind
(
null
,
req
,
req
,
res
,
res
,
url
,
url
,
...
@@ -1719,6 +1721,7 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1719,6 +1721,7 @@ async function renderToHTMLOrFlightImpl(
renderResumeDataCache
,
renderResumeDataCache
,
devValidatingFallbackParams
devValidatingFallbackParams
)
)
const
requestStore
=
createRequestStore
()
if
(
if
(
process
.
env
.
NODE_ENV
===
'development'
&&
process
.
env
.
NODE_ENV
===
'development'
&&
...
@@ -1791,7 +1794,8 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1791,7 +1794,8 @@ async function renderToHTMLOrFlightImpl(
formState
,
formState
,
postponedState
,
postponedState
,
metadata
,
metadata
,
devValidatingFallbackParams
devValidatingFallbackParams
,
createRequestStore
)
)
return
new
RenderResult
(
stream
,
{
return
new
RenderResult
(
stream
,
{
...
@@ -1818,6 +1822,8 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1818,6 +1822,8 @@ async function renderToHTMLOrFlightImpl(
}
}
const
stream
=
await
renderToStreamWithTracing
(
const
stream
=
await
renderToStreamWithTracing
(
// NOTE: in Cache Components (dev), if the render is restarted, it will use a different requestStore
// than the one that we're passing in here.
requestStore
,
requestStore
,
req
,
req
,
res
,
res
,
...
@@ -1826,7 +1832,8 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1826,7 +1832,8 @@ async function renderToHTMLOrFlightImpl(
formState
,
formState
,
postponedState
,
postponedState
,
metadata
,
metadata
,
devValidatingFallbackParams
devValidatingFallbackParams
,
createRequestStore
)
)
// Invalid dynamic usages should only error the request in development.
// Invalid dynamic usages should only error the request in development.
...
@@ -2025,7 +2032,8 @@ async function renderToStream(
...
@@ -2025,7 +2032,8 @@ async function renderToStream(
formState
:
any
,
formState
:
any
,
postponedState
:
PostponedState
|
null
,
postponedState
:
PostponedState
|
null
,
metadata
:
AppPageRenderResultMetadata
,
metadata
:
AppPageRenderResultMetadata
,
devValidatingFallbackParams
:
OpaqueFallbackRouteParams
|
null
devValidatingFallbackParams
:
OpaqueFallbackRouteParams
|
null
,
createRequestStore
:
()
=>
RequestStore
):
Promise
<
ReadableStream
<
Uint8Array
>>
{
):
Promise
<
ReadableStream
<
Uint8Array
>>
{
const
{
assetPrefix
,
htmlRequestId
,
nonce
,
pagePath
,
renderOpts
,
requestId
}
=
const
{
assetPrefix
,
htmlRequestId
,
nonce
,
pagePath
,
renderOpts
,
requestId
}
=
ctx
ctx
...
@@ -2286,8 +2294,7 @@ async function renderToStream(
...
@@ -2286,8 +2294,7 @@ async function renderToStream(
// The initial render acted as a prospective render to warm the caches.
// The initial render acted as a prospective render to warm the caches.
// Now, we need to do another render.
// Now, we need to do another render.
requestStore
=
createRequestStore
()
// TODO(restart-on-cache-miss): we should use a separate request store for this instead
// We've filled the caches, so now we can render as usual.
// We've filled the caches, so now we can render as usual.
requestStore
.
prerenderResumeDataCache
=
null
requestStore
.
prerenderResumeDataCache
=
null
...
@@ -2296,10 +2303,6 @@ async function renderToStream(
...
@@ -2296,10 +2303,6 @@ async function renderToStream(
)
)
requestStore
.
cacheSignal
=
null
requestStore
.
cacheSignal
=
null
// Reset mutable fields.
requestStore
.
prerenderPhase
=
undefined
requestStore
.
usedDynamic
=
undefined
// The initial render already wrote to its debug channel. We're not using it,
// The initial render already wrote to its debug channel. We're not using it,
// so we need to create a new one.
// so we need to create a new one.
const
finalRenderDebugChannel
=
const
finalRenderDebugChannel
=
...
...
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