mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This PR changes the timing used in `CacheSignal.cacheReady()` to work correctly when rendering, not just prerendering. When rendering, React schedules new work in `setImmediate` (as opposed to using a microtask when prerendering), and `CacheSignal.cacheReady()` needs to account for that, because we need to wait longer to make sure that react had time to render and thus we've started all the relevant cache reads. Note that this PR increases the delay for both prerender _and_ render. This is to make it easier to reason about (by not having separate codepaths), but also to not be so tightly coupled to React pinging work in a microtask when prerendering, in case that changes in the future.