Unverified Commit 3b5bae46 authored by Josh Story's avatar Josh Story Committed by GitHub

Only wait for metadata when dynamicIO experiment is on (#70192)

waiting for metadata is only necessary when `dynamicIO` is enabled. In
the long run we will get rid of this waiting anyway when we have async
dynamic APIs so we condition this behavior to be only when dynamicIO is
on for now
parent 727e6257
...@@ -294,6 +294,7 @@ async function createComponentTreeInternal({ ...@@ -294,6 +294,7 @@ async function createComponentTreeInternal({
notFound={ notFound={
NotFoundComponent ? ( NotFoundComponent ? (
<Segment <Segment
isDynamicIO={experimental.dynamicIO}
isStaticGeneration={isStaticGeneration} isStaticGeneration={isStaticGeneration}
ready={getMetadataReady} ready={getMetadataReady}
> >
...@@ -500,6 +501,7 @@ async function createComponentTreeInternal({ ...@@ -500,6 +501,7 @@ async function createComponentTreeInternal({
actualSegment, actualSegment,
<Segment <Segment
key={cacheNodeKey} key={cacheNodeKey}
isDynamicIO={experimental.dynamicIO}
isStaticGeneration={isStaticGeneration} isStaticGeneration={isStaticGeneration}
ready={getMetadataReady} ready={getMetadataReady}
> >
...@@ -530,6 +532,7 @@ async function createComponentTreeInternal({ ...@@ -530,6 +532,7 @@ async function createComponentTreeInternal({
return [ return [
actualSegment, actualSegment,
<Segment <Segment
isDynamicIO={experimental.dynamicIO}
key={cacheNodeKey} key={cacheNodeKey}
isStaticGeneration={isStaticGeneration} isStaticGeneration={isStaticGeneration}
ready={getMetadataReady} ready={getMetadataReady}
...@@ -585,6 +588,7 @@ async function createComponentTreeInternal({ ...@@ -585,6 +588,7 @@ async function createComponentTreeInternal({
<React.Fragment key={cacheNodeKey}> <React.Fragment key={cacheNodeKey}>
<MetadataOutlet ready={getMetadataReady} /> <MetadataOutlet ready={getMetadataReady} />
<Segment <Segment
isDynamicIO={experimental.dynamicIO}
isStaticGeneration={isStaticGeneration} isStaticGeneration={isStaticGeneration}
ready={getMetadataReady} ready={getMetadataReady}
> >
...@@ -608,6 +612,7 @@ async function createComponentTreeInternal({ ...@@ -608,6 +612,7 @@ async function createComponentTreeInternal({
// a lazy hole rather than null // a lazy hole rather than null
<Segment <Segment
key={cacheNodeKey} key={cacheNodeKey}
isDynamicIO={experimental.dynamicIO}
isStaticGeneration={isStaticGeneration} isStaticGeneration={isStaticGeneration}
ready={getMetadataReady} ready={getMetadataReady}
> >
...@@ -636,15 +641,17 @@ async function MetadataOutlet({ ...@@ -636,15 +641,17 @@ async function MetadataOutlet({
} }
async function Segment({ async function Segment({
isDynamicIO,
isStaticGeneration, isStaticGeneration,
ready, ready,
children, children,
}: { }: {
isDynamicIO: boolean
isStaticGeneration: boolean isStaticGeneration: boolean
ready?: () => Promise<void> ready?: () => Promise<void>
children: React.ReactNode children: React.ReactNode
}) { }) {
if (isStaticGeneration && ready) { if (isDynamicIO && isStaticGeneration && ready) {
// During static generation we wait for metadata to complete before rendering segments. // During static generation we wait for metadata to complete before rendering segments.
// This is slower but it allows us to ensure that metadata is finished before we start // This is slower but it allows us to ensure that metadata is finished before we start
// rendering the segment which can synchronously abort the render in certain circumstances // rendering the segment which can synchronously abort the render in certain circumstances
......
...@@ -15,7 +15,7 @@ export type { NextInstance } ...@@ -15,7 +15,7 @@ export type { NextInstance }
// this is due to current --turbo test have a lot of tests fails with timeouts, ends up the whole // this is due to current --turbo test have a lot of tests fails with timeouts, ends up the whole
// test job exceeds the 6 hours limit. // test job exceeds the 6 hours limit.
let testTimeout = shouldRunTurboDevTest() let testTimeout = shouldRunTurboDevTest()
? (240 * 1000) / 4 ? (240 * 1000) / 2
: (process.platform === 'win32' ? 240 : 120) * 1000 : (process.platform === 'win32' ? 240 : 120) * 1000
if (process.env.NEXT_E2E_TEST_TIMEOUT) { if (process.env.NEXT_E2E_TEST_TIMEOUT) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment