Commit 6cb9c3a
committed
Internal
If there are any suspended fallbacks at the end of the `act` scope,
force them to display by running the pending timers (i.e. `setTimeout`).
The public implementation of `act` achieves the same behavior with an
extra check in the work loop (`shouldForceFlushFallbacks`). Since our
internal `act` needs to work in both development and production, without
additional runtime checks, we instead rely on Jest's mock timers.
This doesn't not affect refresh transitions, which are meant to delay
indefinitely, because in that case we exit the work loop without
posting a timer.act: Flush timers at end of scope1 parent d17086c commit 6cb9c3a
5 files changed
Lines changed: 42 additions & 35 deletions
File tree
- packages
- react-dom/src/test-utils
- react-noop-renderer/src
- react-reconciler/src/__tests__
- react-test-renderer/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | | - | |
1179 | | - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1180 | 1182 | | |
1181 | 1183 | | |
1182 | 1184 | | |
| |||
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | | - | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | | - | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
50 | 58 | | |
51 | 59 | | |
52 | 60 | | |
| |||
144 | 152 | | |
145 | 153 | | |
146 | 154 | | |
147 | | - | |
| 155 | + | |
148 | 156 | | |
149 | 157 | | |
150 | 158 | | |
| |||
291 | 299 | | |
292 | 300 | | |
293 | 301 | | |
294 | | - | |
| 302 | + | |
295 | 303 | | |
296 | 304 | | |
297 | 305 | | |
| |||
336 | 344 | | |
337 | 345 | | |
338 | 346 | | |
339 | | - | |
| 347 | + | |
340 | 348 | | |
341 | 349 | | |
342 | 350 | | |
| |||
Lines changed: 15 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| |||
2595 | 2595 | | |
2596 | 2596 | | |
2597 | 2597 | | |
2598 | | - | |
| 2598 | + | |
2599 | 2599 | | |
2600 | 2600 | | |
2601 | 2601 | | |
| |||
2616 | 2616 | | |
2617 | 2617 | | |
2618 | 2618 | | |
2619 | | - | |
2620 | | - | |
| 2619 | + | |
2621 | 2620 | | |
2622 | 2621 | | |
2623 | 2622 | | |
| |||
2635 | 2634 | | |
2636 | 2635 | | |
2637 | 2636 | | |
2638 | | - | |
2639 | | - | |
| 2637 | + | |
2640 | 2638 | | |
2641 | 2639 | | |
2642 | 2640 | | |
| |||
2754 | 2752 | | |
2755 | 2753 | | |
2756 | 2754 | | |
| 2755 | + | |
| 2756 | + | |
2757 | 2757 | | |
2758 | 2758 | | |
2759 | 2759 | | |
2760 | 2760 | | |
2761 | 2761 | | |
2762 | | - | |
| 2762 | + | |
2763 | 2763 | | |
2764 | 2764 | | |
2765 | 2765 | | |
| |||
2768 | 2768 | | |
2769 | 2769 | | |
2770 | 2770 | | |
| 2771 | + | |
2771 | 2772 | | |
2772 | 2773 | | |
2773 | 2774 | | |
2774 | | - | |
2775 | | - | |
| 2775 | + | |
2776 | 2776 | | |
2777 | | - | |
2778 | | - | |
2779 | | - | |
2780 | | - | |
2781 | | - | |
| 2777 | + | |
2782 | 2778 | | |
2783 | 2779 | | |
2784 | | - | |
2785 | | - | |
2786 | 2780 | | |
| 2781 | + | |
| 2782 | + | |
2787 | 2783 | | |
2788 | | - | |
2789 | 2784 | | |
| 2785 | + | |
2790 | 2786 | | |
2791 | 2787 | | |
2792 | | - | |
2793 | 2788 | | |
2794 | | - | |
2795 | | - | |
| 2789 | + | |
2796 | 2790 | | |
2797 | | - | |
2798 | 2791 | | |
| 2792 | + | |
2799 | 2793 | | |
2800 | 2794 | | |
2801 | 2795 | | |
| |||
3989 | 3983 | | |
3990 | 3984 | | |
3991 | 3985 | | |
3992 | | - | |
3993 | | - | |
3994 | | - | |
3995 | 3986 | | |
3996 | 3987 | | |
3997 | 3988 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
687 | | - | |
688 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
689 | 692 | | |
690 | 693 | | |
691 | 694 | | |
| |||
0 commit comments