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
9da7a501
Commit
9da7a501
authored
Oct 09, 2025
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid restartable render behavior for form actions
parent
a26b3bbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
app-render.tsx
packages/next/src/server/app-render/app-render.tsx
+14
-4
No files found.
packages/next/src/server/app-render/app-render.tsx
View file @
9da7a501
...
@@ -1760,6 +1760,7 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1760,6 +1760,7 @@ async function renderToHTMLOrFlightImpl(
renderToStream
renderToStream
)
)
let
didExecuteServerAction
=
false
let
formState
:
null
|
any
=
null
let
formState
:
null
|
any
=
null
if
(
isPossibleActionRequest
)
{
if
(
isPossibleActionRequest
)
{
// For action requests, we don't want to use the resume data cache.
// For action requests, we don't want to use the resume data cache.
...
@@ -1794,7 +1795,7 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1794,7 +1795,7 @@ async function renderToHTMLOrFlightImpl(
postponedState
,
postponedState
,
metadata
,
metadata
,
devValidatingFallbackParams
,
devValidatingFallbackParams
,
createRequestStor
e
undefined
// Prevent restartable-render behavior in dev + Cache Components mod
e
)
)
return
new
RenderResult
(
stream
,
{
return
new
RenderResult
(
stream
,
{
...
@@ -1811,6 +1812,7 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1811,6 +1812,7 @@ async function renderToHTMLOrFlightImpl(
}
}
}
}
didExecuteServerAction
=
true
// Restore the resume data cache
// Restore the resume data cache
requestStore
.
renderResumeDataCache
=
renderResumeDataCache
requestStore
.
renderResumeDataCache
=
renderResumeDataCache
}
}
...
@@ -1832,7 +1834,12 @@ async function renderToHTMLOrFlightImpl(
...
@@ -1832,7 +1834,12 @@ async function renderToHTMLOrFlightImpl(
postponedState
,
postponedState
,
metadata
,
metadata
,
devValidatingFallbackParams
,
devValidatingFallbackParams
,
createRequestStore
// If we're rendering HTML after an action, we don't want restartable-render behavior
// because the result should be dynamic, like it is in prod.
// Also, the request store might have been mutated by the action (e.g. enabling draftMode)
// and we currently we don't copy changes over when creating a new store,
// so the restarted render wouldn't be correct.
didExecuteServerAction
?
undefined
:
createRequestStore
)
)
// Invalid dynamic usages should only error the request in development.
// Invalid dynamic usages should only error the request in development.
...
@@ -2032,7 +2039,7 @@ async function renderToStream(
...
@@ -2032,7 +2039,7 @@ async function renderToStream(
postponedState
:
PostponedState
|
null
,
postponedState
:
PostponedState
|
null
,
metadata
:
AppPageRenderResultMetadata
,
metadata
:
AppPageRenderResultMetadata
,
devValidatingFallbackParams
:
OpaqueFallbackRouteParams
|
null
,
devValidatingFallbackParams
:
OpaqueFallbackRouteParams
|
null
,
createRequestStore
:
(
)
=>
RequestStore
createRequestStore
:
(
()
=>
RequestStore
)
|
undefined
):
Promise
<
ReadableStream
<
Uint8Array
>>
{
):
Promise
<
ReadableStream
<
Uint8Array
>>
{
const
{
assetPrefix
,
htmlRequestId
,
nonce
,
pagePath
,
renderOpts
,
requestId
}
=
const
{
assetPrefix
,
htmlRequestId
,
nonce
,
pagePath
,
renderOpts
,
requestId
}
=
ctx
ctx
...
@@ -2152,7 +2159,10 @@ async function renderToStream(
...
@@ -2152,7 +2159,10 @@ async function renderToStream(
// Edge routes never prerender so we don't have a Prerender environment for anything in edge runtime
// Edge routes never prerender so we don't have a Prerender environment for anything in edge runtime
process
.
env
.
NEXT_RUNTIME
!==
'edge'
&&
process
.
env
.
NEXT_RUNTIME
!==
'edge'
&&
// We only have a Prerender environment for projects opted into cacheComponents
// We only have a Prerender environment for projects opted into cacheComponents
experimental
.
cacheComponents
experimental
.
cacheComponents
&&
// We only do this flow if we can safely recreate the store from scratch
// (which is not the case for renders after an action)
createRequestStore
)
{
)
{
type
RSCPayloadWithValidation
=
InitialRSCPayload
&
{
type
RSCPayloadWithValidation
=
InitialRSCPayload
&
{
/** Only available during cacheComponents development builds. Used for logging errors. */
/** Only available during cacheComponents development builds. Used for logging errors. */
...
...
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