@@ -734,7 +734,7 @@ describe('ReactDOMFizzServer', () => {
734734
735735 const theError = new Error ( 'Test' ) ;
736736 const loggedErrors = [ ] ;
737- function onError ( x ) {
737+ function onError ( x , errorInfo ) {
738738 loggedErrors . push ( x ) ;
739739 return 'Hash of (' + x . message + ')' ;
740740 }
@@ -837,7 +837,7 @@ describe('ReactDOMFizzServer', () => {
837837
838838 const theError = new Error ( 'Test' ) ;
839839 const loggedErrors = [ ] ;
840- function onError ( x ) {
840+ function onError ( x , errorInfo ) {
841841 loggedErrors . push ( x ) ;
842842 return 'hash of (' + x . message + ')' ;
843843 }
@@ -898,7 +898,7 @@ describe('ReactDOMFizzServer', () => {
898898 [
899899 theError . message ,
900900 expectedDigest ,
901- componentStack ( [ 'Suspense' , 'div' , 'App' ] ) ,
901+ componentStack ( [ 'Lazy' , ' Suspense', 'div' , 'App' ] ) ,
902902 ] ,
903903 ] ,
904904 [
@@ -936,7 +936,9 @@ describe('ReactDOMFizzServer', () => {
936936 return (
937937 < div >
938938 < Suspense fallback = { < span > loading...</ span > } >
939- < Erroring isClient = { isClient } />
939+ < Indirection level = { 2 } >
940+ < Erroring isClient = { isClient } />
941+ </ Indirection >
940942 </ Suspense >
941943 </ div >
942944 ) ;
@@ -979,7 +981,15 @@ describe('ReactDOMFizzServer', () => {
979981 [
980982 theError . message ,
981983 expectedDigest ,
982- componentStack ( [ 'Erroring' , 'Suspense' , 'div' , 'App' ] ) ,
984+ componentStack ( [
985+ 'Erroring' ,
986+ 'Indirection' ,
987+ 'Indirection' ,
988+ 'Indirection' ,
989+ 'Suspense' ,
990+ 'div' ,
991+ 'App' ,
992+ ] ) ,
983993 ] ,
984994 ] ,
985995 [
@@ -1330,6 +1340,11 @@ describe('ReactDOMFizzServer', () => {
13301340 < AsyncText text = "Hello" />
13311341 </ h1 >
13321342 </ Suspense >
1343+ < main >
1344+ < Suspense fallback = "loading..." >
1345+ < AsyncText text = "World" />
1346+ </ Suspense >
1347+ </ main >
13331348 </ div >
13341349 ) ;
13351350 }
@@ -1359,7 +1374,11 @@ describe('ReactDOMFizzServer', () => {
13591374 await waitForAll ( [ ] ) ;
13601375
13611376 // 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+ ) ;
13631382
13641383 // We abort the server response.
13651384 await act ( ( ) => {
@@ -1374,26 +1393,44 @@ describe('ReactDOMFizzServer', () => {
13741393 [
13751394 'The server did not finish this Suspense boundary: The render was aborted by the server without a reason.' ,
13761395 expectedDigest ,
1396+ // We get the stack of the task when it was aborted which is why we see `h1`
13771397 componentStack ( [ 'h1' , 'Suspense' , 'div' , 'App' ] ) ,
13781398 ] ,
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+ ] ,
13791404 ] ,
13801405 [
13811406 [
13821407 'The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.' ,
13831408 expectedDigest ,
13841409 ] ,
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+ ] ,
13851414 ] ,
13861415 ) ;
1387- expect ( getVisibleChildren ( container ) ) . toEqual ( < div > Loading...</ div > ) ;
1416+ expect ( getVisibleChildren ( container ) ) . toEqual (
1417+ < div >
1418+ Loading...< main > loading...</ main >
1419+ </ div > ,
1420+ ) ;
13881421
13891422 // We now resolve it on the client.
1390- await clientAct ( ( ) => resolveText ( 'Hello' ) ) ;
1423+ await clientAct ( ( ) => {
1424+ resolveText ( 'Hello' ) ;
1425+ resolveText ( 'World' ) ;
1426+ } ) ;
13911427 assertLog ( [ ] ) ;
13921428
13931429 // The client rendered HTML is now in place.
13941430 expect ( getVisibleChildren ( container ) ) . toEqual (
13951431 < div >
13961432 < h1 > Hello</ h1 >
1433+ < main > World</ main >
13971434 </ div > ,
13981435 ) ;
13991436 } ) ;
0 commit comments