@@ -1127,11 +1127,7 @@ function updateSuspenseComponent(
11271127 progressedState !== null
11281128 ? ( workInProgress . child : any ) . child
11291129 : ( workInProgress . child : any ) ;
1130- reuseProgressedPrimaryChild (
1131- workInProgress ,
1132- primaryChildFragment ,
1133- progressedPrimaryChild ,
1134- ) ;
1130+ primaryChildFragment . child = progressedPrimaryChild ;
11351131 }
11361132
11371133 const fallbackChildFragment = createFiberFromFragment (
@@ -1186,11 +1182,7 @@ function updateSuspenseComponent(
11861182 ? ( workInProgress . child : any ) . child
11871183 : ( workInProgress . child : any ) ;
11881184 if ( progressedPrimaryChild !== currentPrimaryChildFragment . child ) {
1189- reuseProgressedPrimaryChild (
1190- workInProgress ,
1191- primaryChildFragment ,
1192- progressedPrimaryChild ,
1193- ) ;
1185+ primaryChildFragment . child = progressedPrimaryChild ;
11941186 }
11951187 }
11961188
@@ -1213,20 +1205,19 @@ function updateSuspenseComponent(
12131205 // and remove the intermediate fragment fiber.
12141206 const nextPrimaryChildren = nextProps . children ;
12151207 const currentPrimaryChild = currentPrimaryChildFragment . child ;
1216- const currentFallbackChild = currentFallbackChildFragment . child ;
12171208 const primaryChild = reconcileChildFibers (
12181209 workInProgress ,
12191210 currentPrimaryChild ,
12201211 nextPrimaryChildren ,
12211212 renderExpirationTime ,
12221213 ) ;
1223- // Delete the fallback children.
1224- reconcileChildFibers (
1225- workInProgress ,
1226- currentFallbackChild ,
1227- null ,
1228- renderExpirationTime ,
1229- ) ;
1214+
1215+ // If this render doesn't suspend, we need to delete the fallback
1216+ // children. Wait until the complete phase, after we've confirmed the
1217+ // fallback is no longer needed.
1218+ // TODO: Would it be better to store the fallback fragment on
1219+ // the stateNode?
1220+
12301221 // Continue rendering the children, like we normally do.
12311222 child = next = primaryChild ;
12321223 }
@@ -1258,11 +1249,7 @@ function updateSuspenseComponent(
12581249 progressedState !== null
12591250 ? ( workInProgress . child : any ) . child
12601251 : ( workInProgress . child : any ) ;
1261- reuseProgressedPrimaryChild (
1262- workInProgress ,
1263- primaryChildFragment ,
1264- progressedPrimaryChild ,
1265- ) ;
1252+ primaryChildFragment . child = progressedPrimaryChild ;
12661253 }
12671254
12681255 // Create a fragment from the fallback children, too.
@@ -1298,49 +1285,6 @@ function updateSuspenseComponent(
12981285 return next ;
12991286}
13001287
1301- function reuseProgressedPrimaryChild (
1302- workInProgress : Fiber ,
1303- primaryChildFragment : Fiber ,
1304- progressedChild : Fiber | null ,
1305- ) {
1306- // This function is only called outside concurrent mode. Usually, if a work-
1307- // in-progress primary tree suspends, we throw it out and revert back to
1308- // current. Outside concurrent mode, though, we commit the suspended work-in-
1309- // progress, even though it didn't complete. This function reuses the children
1310- // and transfers the effects.
1311- let child = ( primaryChildFragment . child = progressedChild ) ;
1312- while ( child !== null ) {
1313- // Ensure that the first and last effect of the parent corresponds
1314- // to the children's first and last effect.
1315- if ( primaryChildFragment . firstEffect === null ) {
1316- primaryChildFragment . firstEffect = child . firstEffect ;
1317- }
1318- if ( child . lastEffect !== null ) {
1319- if ( primaryChildFragment . lastEffect !== null ) {
1320- primaryChildFragment . lastEffect . nextEffect = child . firstEffect ;
1321- }
1322- primaryChildFragment . lastEffect = child . lastEffect ;
1323- }
1324-
1325- // Append all the effects of the subtree and this fiber onto the effect
1326- // list of the parent. The completion order of the children affects the
1327- // side-effect order.
1328- if ( child . effectTag > PerformedWork ) {
1329- if ( primaryChildFragment . lastEffect !== null ) {
1330- primaryChildFragment . lastEffect . nextEffect = child ;
1331- } else {
1332- primaryChildFragment . firstEffect = child ;
1333- }
1334- primaryChildFragment . lastEffect = child ;
1335- }
1336- child . return = primaryChildFragment ;
1337- child = child . sibling ;
1338- }
1339-
1340- workInProgress . firstEffect = primaryChildFragment . firstEffect ;
1341- workInProgress . lastEffect = primaryChildFragment . lastEffect ;
1342- }
1343-
13441288function updatePortalComponent (
13451289 current : Fiber | null ,
13461290 workInProgress : Fiber ,
0 commit comments