71
cancelTimeout,
72
noTimeout,
73
afterActiveInstanceBlur,
74
- getCurrentEventPriority,
74
startSuspendingCommit,
75
waitForCommitToBeReady,
76
preloadInstance,
77
supportsHydration,
78
+ setCurrentUpdatePriority,
79
+ getCurrentUpdatePriority,
80
+ resolveUpdatePriority,
81
} from './ReactFiberConfig';
82
83
import {createWorkInProgress, resetWorkInProgress} from './ReactFiber';
160
import {
161
DiscreteEventPriority,
162
DefaultEventPriority,
161
- getCurrentUpdatePriority,
162
- setCurrentUpdatePriority,
163
lowerEventPriority,
164
lanesToEventPriority,
165
+ eventPriorityToLane,
166
} from './ReactEventPriorities';
167
import {requestCurrentTransition} from './ReactFiberTransition';
168
import {
643
requestTransitionLane(transition);
644
}
645
645
- // Updates originating inside certain React methods, like flushSync, have
646
- // their priority set by tracking it with a context variable.
647
- //
648
- // The opaque type returned by the host config is internally a lane, so we can
649
- // use that directly.
650
- // TODO: Move this type conversion to the event priority module.
651
- const updateLane: Lane = (getCurrentUpdatePriority(): any);
652
- if (updateLane !== NoLane) {
653
- return updateLane;
654
- }
655
-
656
- // This update originated outside React. Ask the host environment for an
657
- // appropriate priority, based on the type of event.
658
- //
659
- // The opaque type returned by the host config is internally a lane, so we can
660
- // use that directly.
661
- // TODO: Move this type conversion to the event priority module.
662
- const eventLane: Lane = (getCurrentEventPriority(): any);
663
- return eventLane;
646
+ return eventPriorityToLane(resolveUpdatePriority());
647
}
648
649
function requestRetryLane(fiber: Fiber) {
1430
}
1431
1432
export function deferredUpdates<A>(fn: () => A): A {
1450
- const previousPriority = getCurrentUpdatePriority();
1433
const prevTransition = ReactCurrentBatchConfig.transition;
1434
1435
+ const previousPriority = getCurrentUpdatePriority();
1436
try {
1454
- ReactCurrentBatchConfig.transition = null;
1437
setCurrentUpdatePriority(DefaultEventPriority);
1438
+ ReactCurrentBatchConfig.transition = null;
1439
return fn();
1440
} finally {
1441
setCurrentUpdatePriority(previousPriority);
1476
c: C,
1477
d: D,
1478
): R {
1496
- const previousPriority = getCurrentUpdatePriority();
1479
const prevTransition = ReactCurrentBatchConfig.transition;
1480
+ const previousPriority = getCurrentUpdatePriority();
1481
try {
1499
- ReactCurrentBatchConfig.transition = null;
1482
setCurrentUpdatePriority(DiscreteEventPriority);
1483
+ ReactCurrentBatchConfig.transition = null;
1484
return fn(a, b, c, d);
1485
} finally {
1486
setCurrentUpdatePriority(previousPriority);
1517
const previousPriority = getCurrentUpdatePriority();
1518
1519
try {
1537
- ReactCurrentBatchConfig.transition = null;
1520
setCurrentUpdatePriority(DiscreteEventPriority);
1521
+ ReactCurrentBatchConfig.transition = null;
1522
if (fn) {
1523
return fn();
1524
} else {
2699
) {
2700
// TODO: This no longer makes any sense. We already wrap the mutation and
2701
// layout phases. Should be able to remove.
2719
- const previousUpdateLanePriority = getCurrentUpdatePriority();
2702
const prevTransition = ReactCurrentBatchConfig.transition;
2703
2704
+ const previousUpdateLanePriority = getCurrentUpdatePriority();
2705
try {
2723
- ReactCurrentBatchConfig.transition = null;
2706
setCurrentUpdatePriority(DiscreteEventPriority);
2707
+ ReactCurrentBatchConfig.transition = null;
2708
commitRootImpl(
2709
root,
2710
recoverableErrors,
3173
const previousPriority = getCurrentUpdatePriority();
3174
3175
try {
3193
- ReactCurrentBatchConfig.transition = null;
3176
setCurrentUpdatePriority(priority);
3177
+ ReactCurrentBatchConfig.transition = null;
3178
return flushPassiveEffectsImpl();
3179
} finally {
3180
setCurrentUpdatePriority(previousPriority);
3529
3530
export function retryDehydratedSuspenseBoundary(boundaryFiber: Fiber) {
3531
const suspenseState: null | SuspenseState = boundaryFiber.memoizedState;
3549
- let retryLane = NoLane;
3532
+ let retryLane: Lane = NoLane;
3533
if (suspenseState !== null) {
3534
retryLane = suspenseState.retryLane;
3535
}
3537
}
3538
3539
export function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable) {
3557
- let retryLane = NoLane; // Default
3540
+ let retryLane: Lane = NoLane; // Default
3541
let retryCache: WeakSet<Wakeable> | Set<Wakeable> | null;
3542
switch (boundaryFiber.tag) {
3543
case SuspenseComponent: