@@ -1127,11 +1127,7 @@ function updateSuspenseComponent(
1127
1127
progressedState !== null
1128
1128
? ( workInProgress . child : any ) . child
1129
1129
: ( workInProgress . child : any ) ;
1130
- reuseProgressedPrimaryChild (
1131
- workInProgress ,
1132
- primaryChildFragment ,
1133
- progressedPrimaryChild ,
1134
- ) ;
1130
+ primaryChildFragment . child = progressedPrimaryChild ;
1135
1131
}
1136
1132
1137
1133
const fallbackChildFragment = createFiberFromFragment (
@@ -1186,11 +1182,7 @@ function updateSuspenseComponent(
1186
1182
? ( workInProgress . child : any ) . child
1187
1183
: ( workInProgress . child : any ) ;
1188
1184
if ( progressedPrimaryChild !== currentPrimaryChildFragment . child ) {
1189
- reuseProgressedPrimaryChild (
1190
- workInProgress ,
1191
- primaryChildFragment ,
1192
- progressedPrimaryChild ,
1193
- ) ;
1185
+ primaryChildFragment . child = progressedPrimaryChild ;
1194
1186
}
1195
1187
}
1196
1188
@@ -1213,20 +1205,19 @@ function updateSuspenseComponent(
1213
1205
// and remove the intermediate fragment fiber.
1214
1206
const nextPrimaryChildren = nextProps . children ;
1215
1207
const currentPrimaryChild = currentPrimaryChildFragment . child ;
1216
- const currentFallbackChild = currentFallbackChildFragment . child ;
1217
1208
const primaryChild = reconcileChildFibers (
1218
1209
workInProgress ,
1219
1210
currentPrimaryChild ,
1220
1211
nextPrimaryChildren ,
1221
1212
renderExpirationTime ,
1222
1213
) ;
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
+
1230
1221
// Continue rendering the children, like we normally do.
1231
1222
child = next = primaryChild ;
1232
1223
}
@@ -1258,11 +1249,7 @@ function updateSuspenseComponent(
1258
1249
progressedState !== null
1259
1250
? ( workInProgress . child : any ) . child
1260
1251
: ( workInProgress . child : any ) ;
1261
- reuseProgressedPrimaryChild (
1262
- workInProgress ,
1263
- primaryChildFragment ,
1264
- progressedPrimaryChild ,
1265
- ) ;
1252
+ primaryChildFragment . child = progressedPrimaryChild ;
1266
1253
}
1267
1254
1268
1255
// Create a fragment from the fallback children, too.
@@ -1298,49 +1285,6 @@ function updateSuspenseComponent(
1298
1285
return next ;
1299
1286
}
1300
1287
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
-
1344
1288
function updatePortalComponent (
1345
1289
current : Fiber | null ,
1346
1290
workInProgress : Fiber ,
0 commit comments