File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ function advanceTimers(currentTime) {
91
91
timer . sortIndex = timer . expirationTime ;
92
92
push ( taskQueue , timer ) ;
93
93
if ( enableProfiling ) {
94
- markTaskStart ( timer ) ;
94
+ markTaskStart ( timer , currentTime ) ;
95
95
timer . isQueued = true ;
96
96
}
97
97
} else {
Original file line number Diff line number Diff line change @@ -483,6 +483,32 @@ Task 2 [Normal] │ ░░░░░░░░🡐 canceled
483
483
) ;
484
484
} ) ;
485
485
486
+ it ( 'handles delayed tasks' , ( ) => {
487
+ Scheduler . unstable_Profiling . startLoggingProfilingEvents ( ) ;
488
+ scheduleCallback (
489
+ NormalPriority ,
490
+ ( ) => {
491
+ Scheduler . unstable_advanceTime ( 1000 ) ;
492
+ Scheduler . unstable_yieldValue ( 'A' ) ;
493
+ } ,
494
+ {
495
+ delay : 1000 ,
496
+ } ,
497
+ ) ;
498
+ expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
499
+
500
+ Scheduler . unstable_advanceTime ( 1000 ) ;
501
+
502
+ expect ( Scheduler ) . toFlushAndYield ( [ 'A' ] ) ;
503
+
504
+ expect ( stopProfilingAndPrintFlamegraph ( ) ) . toEqual (
505
+ `
506
+ !!! Main thread │████████████████████░░░░░░░░░░░░░░░░░░░░
507
+ Task 1 [Normal] │ ████████████████████
508
+ ` ,
509
+ ) ;
510
+ } ) ;
511
+
486
512
it ( 'handles cancelling a delayed task' , ( ) => {
487
513
Scheduler . unstable_Profiling . startLoggingProfilingEvents ( ) ;
488
514
const task = scheduleCallback (
You can’t perform that action at this time.
0 commit comments