@@ -218,6 +218,7 @@ export type Task = {
218
218
blockedSegment : Segment , // the segment we'll write to
219
219
abortSet : Set < Task > , // the abortable set that this task belongs to
220
220
keyPath : Root | KeyNode , // the path of all parent keys currently rendering
221
+ index : number ,
221
222
formatContext : FormatContext , // the format's specific context (e.g. HTML/SVG/MathML)
222
223
legacyContext : LegacyContext , // the current legacy context that this task is executing in
223
224
context : ContextSnapshot , // the current new context that this task is executing in
@@ -388,6 +389,7 @@ export function createRequest(
388
389
rootSegment ,
389
390
abortSet ,
390
391
null ,
392
+ 0 ,
391
393
rootFormatContext ,
392
394
emptyContextObject ,
393
395
rootContextSnapshot ,
@@ -489,6 +491,7 @@ export function resumeRequest(
489
491
rootSegment ,
490
492
abortSet ,
491
493
null ,
494
+ 0 ,
492
495
postponedState . rootFormatContext ,
493
496
emptyContextObject ,
494
497
rootContextSnapshot ,
@@ -546,6 +549,7 @@ function createTask(
546
549
blockedSegment : Segment ,
547
550
abortSet : Set < Task > ,
548
551
keyPath : Root | KeyNode ,
552
+ index : number ,
549
553
formatContext : FormatContext ,
550
554
legacyContext : LegacyContext ,
551
555
context : ContextSnapshot ,
@@ -564,6 +568,7 @@ function createTask(
564
568
blockedSegment,
565
569
abortSet,
566
570
keyPath,
571
+ index,
567
572
formatContext,
568
573
legacyContext,
569
574
context,
@@ -845,6 +850,7 @@ function renderSuspenseBoundary(
845
850
boundarySegment ,
846
851
fallbackAbortSet ,
847
852
task . keyPath ,
853
+ 1 ,
848
854
task . formatContext ,
849
855
task . legacyContext ,
850
856
task . context ,
@@ -968,7 +974,7 @@ function finishClassComponent(
968
974
childContextTypes ,
969
975
) ;
970
976
task . legacyContext = mergedContext ;
971
- renderNodeDestructive ( request , task , null , nextChildren , 0 ) ;
977
+ renderNode ( request , task , nextChildren , 0 ) ;
972
978
task . legacyContext = previousContext ;
973
979
return ;
974
980
}
@@ -1907,6 +1913,7 @@ function injectPostponedHole(
1907
1913
function spawnNewSuspendedTask (
1908
1914
request : Request ,
1909
1915
task : Task ,
1916
+ childIndex : number ,
1910
1917
thenableState : ThenableState | null ,
1911
1918
x : Wakeable ,
1912
1919
) : void {
@@ -1934,6 +1941,7 @@ function spawnNewSuspendedTask(
1934
1941
newSegment ,
1935
1942
task . abortSet ,
1936
1943
task . keyPath ,
1944
+ childIndex ,
1937
1945
task . formatContext ,
1938
1946
task . legacyContext ,
1939
1947
task . context ,
@@ -1998,17 +2006,24 @@ function renderNode(
1998
2006
if ( typeof x === 'object' && x !== null ) {
1999
2007
// $FlowFixMe[method-unbinding]
2000
2008
if ( typeof x . then === 'function' ) {
2001
- const wakeable : Wakeable = ( x : any ) ;
2002
- const thenableState = getThenableStateAfterSuspending ( ) ;
2003
- spawnNewSuspendedTask ( request , task , thenableState , wakeable ) ;
2004
-
2005
2009
// Restore the context. We assume that this will be restored by the inner
2006
2010
// functions in case nothing throws so we don't use "finally" here.
2007
2011
task . formatContext = previousFormatContext ;
2008
2012
task . legacyContext = previousLegacyContext ;
2009
2013
task . context = previousContext ;
2010
2014
task . keyPath = previousKeyPath ;
2011
2015
task . treeContext = previousTreeContext ;
2016
+
2017
+ const wakeable : Wakeable = ( x : any ) ;
2018
+ const thenableState = getThenableStateAfterSuspending ( ) ;
2019
+ spawnNewSuspendedTask (
2020
+ request ,
2021
+ task ,
2022
+ childIndex ,
2023
+ thenableState ,
2024
+ wakeable ,
2025
+ ) ;
2026
+
2012
2027
// Restore all active ReactContexts to what they were before.
2013
2028
switchContext ( previousContext ) ;
2014
2029
if ( __DEV__ ) {
@@ -2336,7 +2351,13 @@ function retryTask(request: Request, task: Task): void {
2336
2351
const prevThenableState = task . thenableState ;
2337
2352
task . thenableState = null ;
2338
2353
2339
- renderNodeDestructive ( request , task , prevThenableState , task . node , 0 ) ;
2354
+ renderNodeDestructive (
2355
+ request ,
2356
+ task ,
2357
+ prevThenableState ,
2358
+ task . node ,
2359
+ task . index ,
2360
+ ) ;
2340
2361
pushSegmentFinale (
2341
2362
segment . chunks ,
2342
2363
request . renderState ,
0 commit comments