Skip to content

Commit b44da09

Browse files
committed
Don't need defaultPriorityContext
Turns out this isn't necessary. Simpler to keep it as one field.
1 parent 8996c9c commit b44da09

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/renderers/shared/fiber/ReactFiberScheduler.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
6565
const useSyncScheduling = config.useSyncScheduling;
6666

6767
// The priority level to use when scheduling an update.
68-
let priorityContext : (PriorityLevel | null) = null;
69-
// The priority level to use if there is no priority context.
70-
let defaultPriorityContext : PriorityLevel = useSyncScheduling ?
68+
let priorityContext : PriorityLevel = useSyncScheduling ?
7169
SynchronousPriority :
7270
LowPriority;
7371

@@ -583,9 +581,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
583581

584582
// We will process an update caused by each error boundary synchronously.
585583
affectedBoundaries.forEach(boundary => {
586-
const priority = priorityContext !== null ?
587-
priorityContext :
588-
defaultPriorityContext;
584+
const priority = priorityContext;
589585
const root = scheduleErrorBoundaryWork(boundary, priority);
590586
// This should use findNextUnitOfWork() when synchronous scheduling is implemented.
591587
let fiber = cloneFiber(root.current, priority);
@@ -620,9 +616,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
620616

621617
function scheduleWork(root : FiberRoot, priorityLevel : ?PriorityLevel) {
622618
if (priorityLevel == null) {
623-
priorityLevel = priorityContext !== null ?
624-
priorityContext :
625-
defaultPriorityContext;
619+
priorityLevel = priorityContext;
626620
}
627621

628622
if (priorityLevel === SynchronousPriority) {
@@ -642,9 +636,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
642636
function scheduleUpdate(fiber: Fiber, priorityLevel : ?PriorityLevel): void {
643637
// Use priority context if no priority is provided
644638
if (priorityLevel == null) {
645-
priorityLevel = priorityContext !== null ?
646-
priorityContext :
647-
defaultPriorityContext;
639+
priorityLevel = priorityContext;
648640
}
649641

650642
while (true) {

0 commit comments

Comments
 (0)