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
06765ee2
Commit
06765ee2
authored
Oct 09, 2025
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert CacheSignal.cacheReady changes
parent
dfd66b4c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
29 deletions
+8
-29
app-render.tsx
packages/next/src/server/app-render/app-render.tsx
+4
-4
cache-signal.ts
packages/next/src/server/app-render/cache-signal.ts
+2
-21
track-module-loading.instance.ts
...pp-render/module-loading/track-module-loading.instance.ts
+1
-3
module.ts
packages/next/src/server/route-modules/app-route/module.ts
+1
-1
No files found.
packages/next/src/server/app-render/app-render.tsx
View file @
06765ee2
...
@@ -733,7 +733,7 @@ async function prospectiveRuntimeServerPrerender(
...
@@ -733,7 +733,7 @@ async function prospectiveRuntimeServerPrerender(
// The cacheSignal helps us track whether caches are still filling or we are ready
// The cacheSignal helps us track whether caches are still filling or we are ready
// to cut the render off.
// to cut the render off.
const
cacheSignal
=
new
CacheSignal
(
'prerender'
)
const
cacheSignal
=
new
CacheSignal
()
const
initialServerPrerenderStore
:
PrerenderStoreModernRuntime
=
{
const
initialServerPrerenderStore
:
PrerenderStoreModernRuntime
=
{
type
:
'prerender-runtime'
,
type
:
'prerender-runtime'
,
...
@@ -2211,7 +2211,7 @@ async function renderToStream(
...
@@ -2211,7 +2211,7 @@ async function renderToStream(
// This render might end up being used as a prospective render (if there's cache misses),
// This render might end up being used as a prospective render (if there's cache misses),
// so we need to set it up for filling caches.
// so we need to set it up for filling caches.
const
cacheSignal
=
new
CacheSignal
(
'render'
)
const
cacheSignal
=
new
CacheSignal
()
// If we encounter async modules that delay rendering, we'll also need to restart.
// If we encounter async modules that delay rendering, we'll also need to restart.
// TODO(restart-on-cache-miss): technically, we only need to wait for pending *server* modules here,
// TODO(restart-on-cache-miss): technically, we only need to wait for pending *server* modules here,
...
@@ -2828,7 +2828,7 @@ async function spawnDynamicValidationInDev(
...
@@ -2828,7 +2828,7 @@ async function spawnDynamicValidationInDev(
// The cacheSignal helps us track whether caches are still filling or we are
// The cacheSignal helps us track whether caches are still filling or we are
// ready to cut the render off.
// ready to cut the render off.
const
cacheSignal
=
new
CacheSignal
(
'prerender'
)
const
cacheSignal
=
new
CacheSignal
()
const
captureOwnerStackClient
=
React
.
captureOwnerStack
const
captureOwnerStackClient
=
React
.
captureOwnerStack
const
captureOwnerStackServer
=
ComponentMod
.
captureOwnerStack
const
captureOwnerStackServer
=
ComponentMod
.
captureOwnerStack
...
@@ -3568,7 +3568,7 @@ async function prerenderToStream(
...
@@ -3568,7 +3568,7 @@ async function prerenderToStream(
// The cacheSignal helps us track whether caches are still filling or we are ready
// The cacheSignal helps us track whether caches are still filling or we are ready
// to cut the render off.
// to cut the render off.
const
cacheSignal
=
new
CacheSignal
(
'prerender'
)
const
cacheSignal
=
new
CacheSignal
()
let
resumeDataCache
:
RenderResumeDataCache
|
PrerenderResumeDataCache
let
resumeDataCache
:
RenderResumeDataCache
|
PrerenderResumeDataCache
let
renderResumeDataCache
:
RenderResumeDataCache
|
null
=
null
let
renderResumeDataCache
:
RenderResumeDataCache
|
null
=
null
...
...
packages/next/src/server/app-render/cache-signal.ts
View file @
06765ee2
...
@@ -5,11 +5,8 @@
...
@@ -5,11 +5,8 @@
* and should only be used in codepaths gated with this feature.
* and should only be used in codepaths gated with this feature.
*/
*/
import
{
waitAtLeastOneReactRenderTask
}
from
'../../lib/scheduler'
import
{
InvariantError
}
from
'../../shared/lib/invariant-error'
import
{
InvariantError
}
from
'../../shared/lib/invariant-error'
type
CacheSignalMode
=
'prerender'
|
'render'
export
class
CacheSignal
{
export
class
CacheSignal
{
private
count
=
0
private
count
=
0
private
earlyListeners
:
Array
<
()
=>
void
>
=
[]
private
earlyListeners
:
Array
<
()
=>
void
>
=
[]
...
@@ -19,7 +16,7 @@ export class CacheSignal {
...
@@ -19,7 +16,7 @@ export class CacheSignal {
private
subscribedSignals
:
Set
<
CacheSignal
>
|
null
=
null
private
subscribedSignals
:
Set
<
CacheSignal
>
|
null
=
null
constructor
(
private
mode
:
CacheSignalMode
)
{
constructor
()
{
if
(
process
.
env
.
NEXT_RUNTIME
===
'edge'
)
{
if
(
process
.
env
.
NEXT_RUNTIME
===
'edge'
)
{
// we rely on `process.nextTick`, which is not supported in edge
// we rely on `process.nextTick`, which is not supported in edge
throw
new
InvariantError
(
throw
new
InvariantError
(
...
@@ -73,23 +70,7 @@ export class CacheSignal {
...
@@ -73,23 +70,7 @@ export class CacheSignal {
* if there are no inflight cache reads then we wait at least one task to allow initial
* if there are no inflight cache reads then we wait at least one task to allow initial
* cache reads to be initiated.
* cache reads to be initiated.
*/
*/
async
cacheReady
():
Promise
<
void
>
{
cacheReady
()
{
if
(
this
.
mode
===
'prerender'
)
{
return
await
this
.
cacheReadyImpl
()
}
else
{
// During a render, React pings pending tasks (that are waiting for something async to resolve) using `setImmediate`.
// This is unlike a prerender, where they are pinged in a microtask.
// This means that, if we're warming caches via a render (not a prerender),
// we need to give React more time to continue rendering after a cache has resolved
// in order to make sure we've discovered all the caches needed for the current render.
do
{
await
this
.
cacheReadyImpl
()
await
waitAtLeastOneReactRenderTask
()
}
while
(
this
.
hasPendingReads
())
}
}
private
cacheReadyImpl
()
{
return
new
Promise
<
void
>
((
resolve
)
=>
{
return
new
Promise
<
void
>
((
resolve
)
=>
{
this
.
listeners
.
push
(
resolve
)
this
.
listeners
.
push
(
resolve
)
if
(
this
.
count
===
0
)
{
if
(
this
.
count
===
0
)
{
...
...
packages/next/src/server/app-render/module-loading/track-module-loading.instance.ts
View file @
06765ee2
...
@@ -8,9 +8,7 @@ import { isThenable } from '../../../shared/lib/is-thenable'
...
@@ -8,9 +8,7 @@ import { isThenable } from '../../../shared/lib/is-thenable'
let
_moduleLoadingSignal
:
CacheSignal
|
null
let
_moduleLoadingSignal
:
CacheSignal
|
null
function
getModuleLoadingSignal
()
{
function
getModuleLoadingSignal
()
{
if
(
!
_moduleLoadingSignal
)
{
if
(
!
_moduleLoadingSignal
)
{
// The mode doesn't really matter here, because we never wait for `cacheReady()` on this signal,
_moduleLoadingSignal
=
new
CacheSignal
()
// only other signals that subscribe to it via `trackPendingModules`.
_moduleLoadingSignal
=
new
CacheSignal
(
'prerender'
)
}
}
return
_moduleLoadingSignal
return
_moduleLoadingSignal
}
}
...
...
packages/next/src/server/route-modules/app-route/module.ts
View file @
06765ee2
...
@@ -376,7 +376,7 @@ export class AppRouteRouteModule extends RouteModule<
...
@@ -376,7 +376,7 @@ export class AppRouteRouteModule extends RouteModule<
*/
*/
const
prospectiveController
=
new
AbortController
()
const
prospectiveController
=
new
AbortController
()
let
prospectiveRenderIsDynamic
=
false
let
prospectiveRenderIsDynamic
=
false
const
cacheSignal
=
new
CacheSignal
(
'prerender'
)
const
cacheSignal
=
new
CacheSignal
()
let
dynamicTracking
=
createDynamicTrackingState
(
undefined
)
let
dynamicTracking
=
createDynamicTrackingState
(
undefined
)
// TODO: Route handlers are never resumed, so it's counter-intuitive
// TODO: Route handlers are never resumed, so it's counter-intuitive
...
...
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