@@ -43,23 +43,20 @@ import { |
43 | 43 | NoPriority as NoSchedulerPriority, |
44 | 44 | } from './SchedulerWithReactIntegration.new'; |
45 | 45 |
|
46 | | -export const SyncLanePriority: LanePriority = 17; |
47 | | -export const SyncBatchedLanePriority: LanePriority = 16; |
| 46 | +export const SyncLanePriority: LanePriority = 15; |
| 47 | +export const SyncBatchedLanePriority: LanePriority = 14; |
48 | 48 |
|
49 | | -const InputDiscreteHydrationLanePriority: LanePriority = 15; |
50 | | -export const InputDiscreteLanePriority: LanePriority = 14; |
| 49 | +const InputDiscreteHydrationLanePriority: LanePriority = 13; |
| 50 | +export const InputDiscreteLanePriority: LanePriority = 12; |
51 | 51 |
|
52 | | -const InputContinuousHydrationLanePriority: LanePriority = 13; |
53 | | -export const InputContinuousLanePriority: LanePriority = 12; |
| 52 | +const InputContinuousHydrationLanePriority: LanePriority = 11; |
| 53 | +export const InputContinuousLanePriority: LanePriority = 10; |
54 | 54 |
|
55 | | -const DefaultHydrationLanePriority: LanePriority = 11; |
56 | | -export const DefaultLanePriority: LanePriority = 10; |
| 55 | +const DefaultHydrationLanePriority: LanePriority = 9; |
| 56 | +export const DefaultLanePriority: LanePriority = 8; |
57 | 57 |
|
58 | | -const TransitionShortHydrationLanePriority: LanePriority = 9; |
59 | | -export const TransitionShortLanePriority: LanePriority = 8; |
60 | | - |
61 | | -const TransitionLongHydrationLanePriority: LanePriority = 7; |
62 | | -export const TransitionLongLanePriority: LanePriority = 6; |
| 58 | +const TransitionHydrationPriority: LanePriority = 7; |
| 59 | +export const TransitionPriority: LanePriority = 6; |
63 | 60 |
|
64 | 61 | const RetryLanePriority: LanePriority = 5; |
65 | 62 |
|
@@ -89,11 +86,8 @@ const InputContinuousLanes: Lanes = /* */ 0b0000000000000000000 |
89 | 86 | export const DefaultHydrationLane: Lane = /* */ 0b0000000000000000000000100000000; |
90 | 87 | export const DefaultLanes: Lanes = /* */ 0b0000000000000000000111000000000; |
91 | 88 |
|
92 | | -const TransitionShortHydrationLane: Lane = /* */ 0b0000000000000000001000000000000; |
93 | | -const TransitionShortLanes: Lanes = /* */ 0b0000000000000011110000000000000; |
94 | | - |
95 | | -const TransitionLongHydrationLane: Lane = /* */ 0b0000000000000100000000000000000; |
96 | | -const TransitionLongLanes: Lanes = /* */ 0b0000000001111000000000000000000; |
| 89 | +const TransitionHydrationLane: Lane = /* */ 0b0000000000000000001000000000000; |
| 90 | +const TransitionLanes: Lanes = /* */ 0b0000000001111111110000000000000; |
97 | 91 |
|
98 | 92 | const RetryLanes: Lanes = /* */ 0b0000011110000000000000000000000; |
99 | 93 |
|
@@ -160,23 +154,14 @@ function getHighestPriorityLanes(lanes: Lanes | Lane): Lanes { |
160 | 154 | return_highestLanePriority = DefaultLanePriority; |
161 | 155 | return defaultLanes; |
162 | 156 | } |
163 | | - if ((lanes & TransitionShortHydrationLane) !== NoLanes) { |
164 | | - return_highestLanePriority = TransitionShortHydrationLanePriority; |
165 | | - return TransitionShortHydrationLane; |
166 | | - } |
167 | | - const transitionShortLanes = TransitionShortLanes & lanes; |
168 | | - if (transitionShortLanes !== NoLanes) { |
169 | | - return_highestLanePriority = TransitionShortLanePriority; |
170 | | - return transitionShortLanes; |
| 157 | + if ((lanes & TransitionHydrationLane) !== NoLanes) { |
| 158 | + return_highestLanePriority = TransitionHydrationPriority; |
| 159 | + return TransitionHydrationLane; |
171 | 160 | } |
172 | | - if ((lanes & TransitionLongHydrationLane) !== NoLanes) { |
173 | | - return_highestLanePriority = TransitionLongHydrationLanePriority; |
174 | | - return TransitionLongHydrationLane; |
175 | | - } |
176 | | - const transitionLongLanes = TransitionLongLanes & lanes; |
177 | | - if (transitionLongLanes !== NoLanes) { |
178 | | - return_highestLanePriority = TransitionLongLanePriority; |
179 | | - return transitionLongLanes; |
| 161 | + const transitionLanes = TransitionLanes & lanes; |
| 162 | + if (transitionLanes !== NoLanes) { |
| 163 | + return_highestLanePriority = TransitionPriority; |
| 164 | + return transitionLanes; |
180 | 165 | } |
181 | 166 | const retryLanes = RetryLanes & lanes; |
182 | 167 | if (retryLanes !== NoLanes) { |
@@ -241,10 +226,8 @@ export function lanePriorityToSchedulerPriority( |
241 | 226 | return UserBlockingSchedulerPriority; |
242 | 227 | case DefaultHydrationLanePriority: |
243 | 228 | case DefaultLanePriority: |
244 | | - case TransitionShortHydrationLanePriority: |
245 | | - case TransitionShortLanePriority: |
246 | | - case TransitionLongHydrationLanePriority: |
247 | | - case TransitionLongLanePriority: |
| 229 | + case TransitionHydrationPriority: |
| 230 | + case TransitionPriority: |
248 | 231 | case SelectiveHydrationLanePriority: |
249 | 232 | case RetryLanePriority: |
250 | 233 | return NormalSchedulerPriority; |
@@ -402,7 +385,7 @@ function computeExpirationTime(lane: Lane, currentTime: number) { |
402 | 385 | if (priority >= InputContinuousLanePriority) { |
403 | 386 | // User interactions should expire slightly more quickly. |
404 | 387 | return currentTime + 1000; |
405 | | - } else if (priority >= TransitionLongLanePriority) { |
| 388 | + } else if (priority >= TransitionPriority) { |
406 | 389 | return currentTime + 5000; |
407 | 390 | } else { |
408 | 391 | // Anything idle priority or lower should never expire. |
@@ -513,9 +496,7 @@ export function findUpdateLane( |
513 | 496 | if (lane === NoLane) { |
514 | 497 | // If all the default lanes are already being worked on, look for a |
515 | 498 | // lane in the transition range. |
516 | | - lane = pickArbitraryLane( |
517 | | - (TransitionShortLanes | TransitionLongLanes) & ~wipLanes, |
518 | | - ); |
| 499 | + lane = pickArbitraryLane(TransitionLanes & ~wipLanes); |
519 | 500 | if (lane === NoLane) { |
520 | 501 | // All the transition lanes are taken, too. This should be very |
521 | 502 | // rare, but as a last resort, pick a default lane. This will have |
@@ -525,8 +506,7 @@ export function findUpdateLane( |
525 | 506 | } |
526 | 507 | return lane; |
527 | 508 | } |
528 | | - case TransitionShortLanePriority: // Should be handled by findTransitionLane instead |
529 | | - case TransitionLongLanePriority: |
| 509 | + case TransitionPriority: // Should be handled by findTransitionLane instead |
530 | 510 | case RetryLanePriority: // Should be handled by findRetryLane instead |
531 | 511 | break; |
532 | 512 | case IdleLanePriority: |
@@ -548,48 +528,21 @@ export function findUpdateLane( |
548 | 528 |
|
549 | 529 | // To ensure consistency across multiple updates in the same event, this should |
550 | 530 | // be pure function, so that it always returns the same lane for given inputs. |
551 | | -export function findTransitionLane( |
552 | | - lanePriority: LanePriority, |
553 | | - wipLanes: Lanes, |
554 | | - pendingLanes: Lanes, |
555 | | -): Lane { |
556 | | - if (lanePriority === TransitionShortLanePriority) { |
557 | | - // First look for lanes that are completely unclaimed, i.e. have no |
558 | | - // pending work. |
559 | | - let lane = pickArbitraryLane(TransitionShortLanes & ~pendingLanes); |
560 | | - if (lane === NoLane) { |
561 | | - // If all lanes have pending work, look for a lane that isn't currently |
562 | | - // being worked on. |
563 | | - lane = pickArbitraryLane(TransitionShortLanes & ~wipLanes); |
564 | | - if (lane === NoLane) { |
565 | | - // If everything is being worked on, pick any lane. This has the |
566 | | - // effect of interrupting the current work-in-progress. |
567 | | - lane = pickArbitraryLane(TransitionShortLanes); |
568 | | - } |
569 | | - } |
570 | | - return lane; |
571 | | - } |
572 | | - if (lanePriority === TransitionLongLanePriority) { |
573 | | - // First look for lanes that are completely unclaimed, i.e. have no |
574 | | - // pending work. |
575 | | - let lane = pickArbitraryLane(TransitionLongLanes & ~pendingLanes); |
| 531 | +export function findTransitionLane(wipLanes: Lanes, pendingLanes: Lanes): Lane { |
| 532 | + // First look for lanes that are completely unclaimed, i.e. have no |
| 533 | + // pending work. |
| 534 | + let lane = pickArbitraryLane(TransitionLanes & ~pendingLanes); |
| 535 | + if (lane === NoLane) { |
| 536 | + // If all lanes have pending work, look for a lane that isn't currently |
| 537 | + // being worked on. |
| 538 | + lane = pickArbitraryLane(TransitionLanes & ~wipLanes); |
576 | 539 | if (lane === NoLane) { |
577 | | - // If all lanes have pending work, look for a lane that isn't currently |
578 | | - // being worked on. |
579 | | - lane = pickArbitraryLane(TransitionLongLanes & ~wipLanes); |
580 | | - if (lane === NoLane) { |
581 | | - // If everything is being worked on, pick any lane. This has the |
582 | | - // effect of interrupting the current work-in-progress. |
583 | | - lane = pickArbitraryLane(TransitionLongLanes); |
584 | | - } |
| 540 | + // If everything is being worked on, pick any lane. This has the |
| 541 | + // effect of interrupting the current work-in-progress. |
| 542 | + lane = pickArbitraryLane(TransitionLanes); |
585 | 543 | } |
586 | | - return lane; |
587 | 544 | } |
588 | | - invariant( |
589 | | - false, |
590 | | - 'Invalid transition priority: %s. This is a bug in React.', |
591 | | - lanePriority, |
592 | | - ); |
| 545 | + return lane; |
593 | 546 | } |
594 | 547 |
|
595 | 548 | // To ensure consistency across multiple updates in the same event, this should |
@@ -816,18 +769,14 @@ export function getBumpedLaneForHydration( |
816 | 769 | case DefaultLanePriority: |
817 | 770 | lane = DefaultHydrationLane; |
818 | 771 | break; |
819 | | - case TransitionShortHydrationLanePriority: |
820 | | - case TransitionShortLanePriority: |
821 | | - lane = TransitionShortHydrationLane; |
822 | | - break; |
823 | | - case TransitionLongHydrationLanePriority: |
824 | | - case TransitionLongLanePriority: |
825 | | - lane = TransitionLongHydrationLane; |
| 772 | + case TransitionHydrationPriority: |
| 773 | + case TransitionPriority: |
| 774 | + lane = TransitionHydrationLane; |
826 | 775 | break; |
827 | 776 | case RetryLanePriority: |
828 | 777 | // Shouldn't be reachable under normal circumstances, so there's no |
829 | 778 | // dedicated lane for retry priority. Use the one for long transitions. |
830 | | - lane = TransitionLongHydrationLane; |
| 779 | + lane = TransitionHydrationLane; |
831 | 780 | break; |
832 | 781 | case SelectiveHydrationLanePriority: |
833 | 782 | lane = SelectiveHydrationLane; |
|