Commit 0b931f9
authored
Remove JND delay for non-transition updates (#26597)
Updates that are marked as part of a transition are allowed to block a
render from committing. Generally, other updates cannot — however,
there's one exception that's leftover from a previous iteration of our
Suspense architecture. If an update is not the result of a known urgent
event type — known as "Default" updates — then we allow it to suspend
briefly, as long as the delay is short enough that the user won't
notice. We refer to this delay as a "Just Noticable Difference" (JND)
delay. To illustrate, if the user has already waited 400ms for an update
to be reflected on the screen, the theory is that they won't notice if
you wait an additional 100ms. So React can suspend for a bit longer in
case more data comes in. The longer the user has already waited, the
longer the JND.
While we still believe this theory is sound from a UX perspective, we no
longer think the implementation complexity is worth it. The main thing
that's changed is how we handle Default updates. We used to render
Default updates concurrently (i.e. they were time sliced, and were
scheduled with postTask), but now they are blocking. Soon, they will
also be scheduled with rAF, too, which means by the end of the next rAF,
they will have either finished rendering or the main thread will be
blocked until they do. There are various motivations for this but part
of the rationale is that anything that can be made non-blocking should
be marked as a Transition, anyway, so it's not worth adding
implementation complexity to Default.
This commit removes the JND delay for Default updates. They will now
commit immediately once the render phase is complete, even if a
component suspends.1 parent ac43bf6 commit 0b931f9
File tree
10 files changed
+114
-743
lines changed- packages
- react-cache/src/__tests__
- react-reconciler/src
- __tests__
10 files changed
+114
-743
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
| |||
284 | 283 | | |
285 | 284 | | |
286 | 285 | | |
287 | | - | |
288 | | - | |
289 | 286 | | |
290 | 287 | | |
291 | 288 | | |
| |||
1193 | 1190 | | |
1194 | 1191 | | |
1195 | 1192 | | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | 1193 | | |
1229 | 1194 | | |
1230 | 1195 | | |
| |||
3580 | 3545 | | |
3581 | 3546 | | |
3582 | 3547 | | |
3583 | | - | |
3584 | | - | |
3585 | | - | |
3586 | | - | |
3587 | | - | |
3588 | | - | |
3589 | | - | |
3590 | | - | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
3594 | | - | |
3595 | | - | |
3596 | | - | |
3597 | | - | |
3598 | | - | |
3599 | | - | |
3600 | | - | |
3601 | | - | |
3602 | | - | |
3603 | | - | |
3604 | | - | |
3605 | | - | |
3606 | | - | |
3607 | | - | |
3608 | 3548 | | |
3609 | 3549 | | |
3610 | 3550 | | |
| |||
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
| 735 | + | |
740 | 736 | | |
741 | | - | |
| 737 | + | |
742 | 738 | | |
743 | 739 | | |
744 | 740 | | |
| |||
Lines changed: 10 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
| 695 | + | |
700 | 696 | | |
701 | | - | |
| 697 | + | |
702 | 698 | | |
703 | 699 | | |
704 | 700 | | |
705 | 701 | | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
| 702 | + | |
711 | 703 | | |
712 | | - | |
| 704 | + | |
713 | 705 | | |
714 | 706 | | |
715 | 707 | | |
| |||
755 | 747 | | |
756 | 748 | | |
757 | 749 | | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 750 | + | |
764 | 751 | | |
765 | 752 | | |
766 | | - | |
| 753 | + | |
767 | 754 | | |
768 | 755 | | |
769 | 756 | | |
770 | 757 | | |
771 | 758 | | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
| 759 | + | |
777 | 760 | | |
778 | | - | |
| 761 | + | |
779 | 762 | | |
780 | 763 | | |
781 | 764 | | |
782 | 765 | | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
| 766 | + | |
788 | 767 | | |
789 | | - | |
| 768 | + | |
790 | 769 | | |
791 | 770 | | |
792 | 771 | | |
| |||
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1414 | 1414 | | |
1415 | 1415 | | |
1416 | 1416 | | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1421 | 1423 | | |
1422 | 1424 | | |
1423 | 1425 | | |
| |||
1559 | 1561 | | |
1560 | 1562 | | |
1561 | 1563 | | |
1562 | | - | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
1566 | | - | |
| 1564 | + | |
1567 | 1565 | | |
1568 | | - | |
| 1566 | + | |
1569 | 1567 | | |
1570 | 1568 | | |
1571 | 1569 | | |
| |||
Lines changed: 29 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
407 | 409 | | |
408 | 410 | | |
409 | 411 | | |
410 | | - | |
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
| |||
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | 446 | | |
449 | 447 | | |
450 | 448 | | |
451 | 449 | | |
452 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
453 | 454 | | |
454 | 455 | | |
455 | | - | |
| 456 | + | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| |||
466 | 467 | | |
467 | 468 | | |
468 | 469 | | |
469 | | - | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
| 472 | + | |
472 | 473 | | |
473 | 474 | | |
474 | 475 | | |
475 | 476 | | |
476 | | - | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
479 | 480 | | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
484 | 485 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
489 | 492 | | |
490 | | - | |
| 493 | + | |
491 | 494 | | |
492 | 495 | | |
493 | 496 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | 497 | | |
506 | 498 | | |
507 | 499 | | |
508 | 500 | | |
509 | 501 | | |
510 | | - | |
511 | 502 | | |
512 | | - | |
| 503 | + | |
| 504 | + | |
513 | 505 | | |
514 | 506 | | |
515 | 507 | | |
| |||
520 | 512 | | |
521 | 513 | | |
522 | 514 | | |
523 | | - | |
524 | | - | |
| 515 | + | |
| 516 | + | |
525 | 517 | | |
526 | 518 | | |
527 | | - | |
528 | 519 | | |
529 | | - | |
530 | | - | |
| 520 | + | |
| 521 | + | |
531 | 522 | | |
532 | 523 | | |
533 | 524 | | |
| |||
536 | 527 | | |
537 | 528 | | |
538 | 529 | | |
539 | | - | |
540 | | - | |
541 | 530 | | |
542 | 531 | | |
543 | 532 | | |
544 | 533 | | |
545 | 534 | | |
546 | | - | |
547 | | - | |
548 | | - | |
| 535 | + | |
| 536 | + | |
549 | 537 | | |
550 | 538 | | |
551 | 539 | | |
552 | 540 | | |
553 | | - | |
554 | 541 | | |
555 | | - | |
556 | | - | |
| 542 | + | |
| 543 | + | |
557 | 544 | | |
558 | 545 | | |
559 | 546 | | |
560 | 547 | | |
561 | | - | |
562 | 548 | | |
563 | | - | |
564 | | - | |
| 549 | + | |
| 550 | + | |
565 | 551 | | |
566 | 552 | | |
567 | 553 | | |
| |||
0 commit comments