@@ -734,7 +734,7 @@ describe('ReactDOMFizzServer', () => {
734
734
735
735
const theError = new Error ( 'Test' ) ;
736
736
const loggedErrors = [ ] ;
737
- function onError ( x ) {
737
+ function onError ( x , errorInfo ) {
738
738
loggedErrors . push ( x ) ;
739
739
return 'Hash of (' + x . message + ')' ;
740
740
}
@@ -837,7 +837,7 @@ describe('ReactDOMFizzServer', () => {
837
837
838
838
const theError = new Error ( 'Test' ) ;
839
839
const loggedErrors = [ ] ;
840
- function onError ( x ) {
840
+ function onError ( x , errorInfo ) {
841
841
loggedErrors . push ( x ) ;
842
842
return 'hash of (' + x . message + ')' ;
843
843
}
@@ -898,7 +898,7 @@ describe('ReactDOMFizzServer', () => {
898
898
[
899
899
theError . message ,
900
900
expectedDigest ,
901
- componentStack ( [ 'Suspense' , 'div' , 'App' ] ) ,
901
+ componentStack ( [ 'Lazy' , ' Suspense', 'div' , 'App' ] ) ,
902
902
] ,
903
903
] ,
904
904
[
@@ -936,7 +936,9 @@ describe('ReactDOMFizzServer', () => {
936
936
return (
937
937
< div >
938
938
< Suspense fallback = { < span > loading...</ span > } >
939
- < Erroring isClient = { isClient } />
939
+ < Indirection level = { 2 } >
940
+ < Erroring isClient = { isClient } />
941
+ </ Indirection >
940
942
</ Suspense >
941
943
</ div >
942
944
) ;
@@ -979,7 +981,15 @@ describe('ReactDOMFizzServer', () => {
979
981
[
980
982
theError . message ,
981
983
expectedDigest ,
982
- componentStack ( [ 'Erroring' , 'Suspense' , 'div' , 'App' ] ) ,
984
+ componentStack ( [
985
+ 'Erroring' ,
986
+ 'Indirection' ,
987
+ 'Indirection' ,
988
+ 'Indirection' ,
989
+ 'Suspense' ,
990
+ 'div' ,
991
+ 'App' ,
992
+ ] ) ,
983
993
] ,
984
994
] ,
985
995
[
@@ -1330,6 +1340,11 @@ describe('ReactDOMFizzServer', () => {
1330
1340
< AsyncText text = "Hello" />
1331
1341
</ h1 >
1332
1342
</ Suspense >
1343
+ < main >
1344
+ < Suspense fallback = "loading..." >
1345
+ < AsyncText text = "World" />
1346
+ </ Suspense >
1347
+ </ main >
1333
1348
</ div >
1334
1349
) ;
1335
1350
}
@@ -1359,7 +1374,11 @@ describe('ReactDOMFizzServer', () => {
1359
1374
await waitForAll ( [ ] ) ;
1360
1375
1361
1376
// We're still loading because we're waiting for the server to stream more content.
1362
- expect ( getVisibleChildren ( container ) ) . toEqual ( < div > Loading...</ div > ) ;
1377
+ expect ( getVisibleChildren ( container ) ) . toEqual (
1378
+ < div >
1379
+ Loading...< main > loading...</ main >
1380
+ </ div > ,
1381
+ ) ;
1363
1382
1364
1383
// We abort the server response.
1365
1384
await act ( ( ) => {
@@ -1374,26 +1393,44 @@ describe('ReactDOMFizzServer', () => {
1374
1393
[
1375
1394
'The server did not finish this Suspense boundary: The render was aborted by the server without a reason.' ,
1376
1395
expectedDigest ,
1396
+ // We get the stack of the task when it was aborted which is why we see `h1`
1377
1397
componentStack ( [ 'h1' , 'Suspense' , 'div' , 'App' ] ) ,
1378
1398
] ,
1399
+ [
1400
+ 'The server did not finish this Suspense boundary: The render was aborted by the server without a reason.' ,
1401
+ expectedDigest ,
1402
+ componentStack ( [ 'Suspense' , 'main' , 'div' , 'App' ] ) ,
1403
+ ] ,
1379
1404
] ,
1380
1405
[
1381
1406
[
1382
1407
'The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.' ,
1383
1408
expectedDigest ,
1384
1409
] ,
1410
+ [
1411
+ 'The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.' ,
1412
+ expectedDigest ,
1413
+ ] ,
1385
1414
] ,
1386
1415
) ;
1387
- expect ( getVisibleChildren ( container ) ) . toEqual ( < div > Loading...</ div > ) ;
1416
+ expect ( getVisibleChildren ( container ) ) . toEqual (
1417
+ < div >
1418
+ Loading...< main > loading...</ main >
1419
+ </ div > ,
1420
+ ) ;
1388
1421
1389
1422
// We now resolve it on the client.
1390
- await clientAct ( ( ) => resolveText ( 'Hello' ) ) ;
1423
+ await clientAct ( ( ) => {
1424
+ resolveText ( 'Hello' ) ;
1425
+ resolveText ( 'World' ) ;
1426
+ } ) ;
1391
1427
assertLog ( [ ] ) ;
1392
1428
1393
1429
// The client rendered HTML is now in place.
1394
1430
expect ( getVisibleChildren ( container ) ) . toEqual (
1395
1431
< div >
1396
1432
< h1 > Hello</ h1 >
1433
+ < main > World</ main >
1397
1434
</ div > ,
1398
1435
) ;
1399
1436
} ) ;
0 commit comments