@@ -2234,23 +2234,18 @@ function performAsyncWork(didTimeout) {
2234
2234
} while ( root !== firstScheduledRoot ) ;
2235
2235
}
2236
2236
}
2237
- let isYieldy = true ;
2238
- if ( disableYielding ) {
2239
- isYieldy = false ;
2240
- }
2241
- performWork ( NoWork , isYieldy ) ;
2242
- }
2243
-
2244
- function performSyncWork ( ) {
2245
- performWork ( Sync , false ) ;
2246
- }
2247
2237
2248
- function performWork ( minExpirationTime : ExpirationTime , isYieldy : boolean ) {
2249
2238
// Keep working on roots until there's no more work, or until there's a higher
2250
2239
// priority event.
2251
2240
findHighestPriorityRoot ( ) ;
2252
2241
2253
- if ( isYieldy ) {
2242
+ if ( disableYielding ) {
2243
+ // Just do it all
2244
+ while ( nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork ) {
2245
+ performWorkOnRoot ( nextFlushedRoot , nextFlushedExpirationTime , false ) ;
2246
+ findHighestPriorityRoot ( ) ;
2247
+ }
2248
+ } else {
2254
2249
recomputeCurrentRendererTime ( ) ;
2255
2250
currentSchedulerTime = currentRendererTime ;
2256
2251
@@ -2263,7 +2258,6 @@ function performWork(minExpirationTime: ExpirationTime, isYieldy: boolean) {
2263
2258
while (
2264
2259
nextFlushedRoot !== null &&
2265
2260
nextFlushedExpirationTime !== NoWork &&
2266
- minExpirationTime <= nextFlushedExpirationTime &&
2267
2261
! ( shouldYield ( ) && currentRendererTime > nextFlushedExpirationTime )
2268
2262
) {
2269
2263
performWorkOnRoot (
@@ -2275,25 +2269,48 @@ function performWork(minExpirationTime: ExpirationTime, isYieldy: boolean) {
2275
2269
recomputeCurrentRendererTime ( ) ;
2276
2270
currentSchedulerTime = currentRendererTime ;
2277
2271
}
2278
- } else {
2279
- while (
2280
- nextFlushedRoot !== null &&
2281
- nextFlushedExpirationTime !== NoWork &&
2282
- minExpirationTime <= nextFlushedExpirationTime
2283
- ) {
2284
- performWorkOnRoot ( nextFlushedRoot , nextFlushedExpirationTime , false ) ;
2285
- findHighestPriorityRoot ( ) ;
2286
- }
2287
2272
}
2288
2273
2289
2274
// We're done flushing work. Either we ran out of time in this callback,
2290
2275
// or there's no more work left with sufficient priority.
2291
2276
2292
2277
// If we're inside a callback, set this to false since we just completed it.
2293
- if ( isYieldy ) {
2294
- callbackExpirationTime = NoWork ;
2295
- callbackID = null ;
2278
+ callbackExpirationTime = NoWork ;
2279
+ callbackID = null ;
2280
+
2281
+ // If there's work left over, schedule a new callback.
2282
+ if ( nextFlushedExpirationTime !== NoWork ) {
2283
+ scheduleCallbackWithExpirationTime (
2284
+ ( ( nextFlushedRoot : any ) : FiberRoot ) ,
2285
+ nextFlushedExpirationTime ,
2286
+ ) ;
2287
+ }
2288
+
2289
+ // Clean-up.
2290
+ finishRendering ( ) ;
2291
+ }
2292
+
2293
+ function performSyncWork ( ) {
2294
+ performWork ( Sync ) ;
2295
+ }
2296
+
2297
+ function performWork ( minExpirationTime : ExpirationTime ) {
2298
+ // Keep working on roots until there's no more work, or until there's a higher
2299
+ // priority event.
2300
+ findHighestPriorityRoot ( ) ;
2301
+
2302
+ while (
2303
+ nextFlushedRoot !== null &&
2304
+ nextFlushedExpirationTime !== NoWork &&
2305
+ minExpirationTime <= nextFlushedExpirationTime
2306
+ ) {
2307
+ performWorkOnRoot ( nextFlushedRoot , nextFlushedExpirationTime , false ) ;
2308
+ findHighestPriorityRoot ( ) ;
2296
2309
}
2310
+
2311
+ // We're done flushing work. Either we ran out of time in this callback,
2312
+ // or there's no more work left with sufficient priority.
2313
+
2297
2314
// If there's work left over, schedule a new callback.
2298
2315
if ( nextFlushedExpirationTime !== NoWork ) {
2299
2316
scheduleCallbackWithExpirationTime (
@@ -2547,7 +2564,7 @@ function interactiveUpdates<A, B, C, R>(
2547
2564
lowestPriorityPendingInteractiveExpirationTime !== NoWork
2548
2565
) {
2549
2566
// Synchronously flush pending interactive updates.
2550
- performWork ( lowestPriorityPendingInteractiveExpirationTime , false ) ;
2567
+ performWork ( lowestPriorityPendingInteractiveExpirationTime ) ;
2551
2568
lowestPriorityPendingInteractiveExpirationTime = NoWork ;
2552
2569
}
2553
2570
const previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates ;
@@ -2571,7 +2588,7 @@ function flushInteractiveUpdates() {
2571
2588
lowestPriorityPendingInteractiveExpirationTime !== NoWork
2572
2589
) {
2573
2590
// Synchronously flush pending interactive updates.
2574
- performWork ( lowestPriorityPendingInteractiveExpirationTime , false ) ;
2591
+ performWork ( lowestPriorityPendingInteractiveExpirationTime ) ;
2575
2592
lowestPriorityPendingInteractiveExpirationTime = NoWork ;
2576
2593
}
2577
2594
}
0 commit comments