File tree 5 files changed +21
-20
lines changed
test/e2e/app-dir/dynamic-io-errors
5 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -387,11 +387,7 @@ async function exportAppImpl(
387
387
strictNextHead : nextConfig . experimental . strictNextHead ?? true ,
388
388
deploymentId : nextConfig . deploymentId ,
389
389
htmlLimitedBots : nextConfig . htmlLimitedBots . source ,
390
- streamingMetadata :
391
- // Disable streaming metadata when dynamic IO is enabled.
392
- // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.
393
- // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route
394
- ! nextConfig . experimental . dynamicIO ,
390
+ streamingMetadata : true ,
395
391
experimental : {
396
392
clientTraceMetadata : nextConfig . experimental . clientTraceMetadata ,
397
393
expireTime : nextConfig . expireTime ,
Original file line number Diff line number Diff line change @@ -425,11 +425,7 @@ export async function exportPages(
425
425
enableExperimentalReact : needsExperimentalReact ( nextConfig ) ,
426
426
sriEnabled : Boolean ( nextConfig . experimental . sri ?. algorithm ) ,
427
427
buildId : input . buildId ,
428
- streamingMetadata :
429
- // Disable streaming metadata when dynamic IO is enabled.
430
- // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.
431
- // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route
432
- ! nextConfig . experimental . dynamicIO ,
428
+ streamingMetadata : true ,
433
429
} ) ,
434
430
// If exporting the page takes longer than the timeout, reject the promise.
435
431
new Promise ( ( _ , reject ) => {
Original file line number Diff line number Diff line change @@ -2446,6 +2446,7 @@ async function spawnDynamicValidationInDev(
2446
2446
}
2447
2447
)
2448
2448
2449
+ let rootDidError = false
2449
2450
const serverPhasedStream = serverPrerenderStreamResult . asPhasedStream ( )
2450
2451
try {
2451
2452
const prerender = require ( 'react-dom/static.edge' )
@@ -2476,7 +2477,12 @@ async function spawnDynamicValidationInDev(
2476
2477
isPrerenderInterruptedError ( err ) ||
2477
2478
finalClientController . signal . aborted
2478
2479
) {
2479
- requestStore . usedDynamic = true
2480
+ if ( ! rootDidError ) {
2481
+ // If the root errored before we observe this error then it wasn't caused by something dynamic.
2482
+ // If the root did not error or is erroring because of a sync dynamic API or a prerender interrupt error
2483
+ // then we are a dynamic route.
2484
+ requestStore . usedDynamic = true
2485
+ }
2480
2486
2481
2487
const componentStack = errorInfo . componentStack
2482
2488
if ( typeof componentStack === 'string' ) {
@@ -2501,6 +2507,7 @@ async function spawnDynamicValidationInDev(
2501
2507
}
2502
2508
)
2503
2509
} catch ( err ) {
2510
+ rootDidError = true
2504
2511
if (
2505
2512
isPrerenderInterruptedError ( err ) ||
2506
2513
finalClientController . signal . aborted
Original file line number Diff line number Diff line change @@ -600,11 +600,7 @@ export default abstract class Server<
600
600
isExperimentalCompile : this . nextConfig . experimental . isExperimentalCompile ,
601
601
// `htmlLimitedBots` is passed to server as serialized config in string format
602
602
htmlLimitedBots : this . nextConfig . htmlLimitedBots ,
603
- streamingMetadata :
604
- // Disable streaming metadata when dynamic IO is enabled.
605
- // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.
606
- // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route
607
- ! this . nextConfig . experimental . dynamicIO ,
603
+ streamingMetadata : true ,
608
604
experimental : {
609
605
expireTime : this . nextConfig . expireTime ,
610
606
clientTraceMetadata : this . nextConfig . experimental . clientTraceMetadata ,
Original file line number Diff line number Diff line change @@ -159,10 +159,16 @@ function runTests(options: { withMinification: boolean }) {
159
159
throw new Error ( 'expected build not to fail for fully static project' )
160
160
}
161
161
162
- expect ( next . cliOutput ) . toContain ( 'ƒ / ' )
163
- const $ = await next . render$ ( '/' )
164
- expect ( $ ( '#dynamic' ) . text ( ) ) . toBe ( 'Dynamic' )
165
- expect ( $ ( '[data-fallback]' ) . length ) . toBe ( 0 )
162
+ if ( WITH_PPR ) {
163
+ expect ( next . cliOutput ) . toContain ( '◐ / ' )
164
+ const $ = await next . render$ ( '/' )
165
+ expect ( $ ( '#dynamic' ) . text ( ) ) . toBe ( 'Dynamic' )
166
+ expect ( $ ( '[data-fallback]' ) . length ) . toBe ( 1 )
167
+ } else {
168
+ expect ( next . cliOutput ) . toContain ( 'ƒ / ' )
169
+ const $ = await next . render$ ( '/' )
170
+ expect ( $ ( '#dynamic' ) . text ( ) ) . toBe ( 'Dynamic' )
171
+ }
166
172
} )
167
173
} )
168
174
You can’t perform that action at this time.
0 commit comments