@samitouri / QOS-React / commits / 2e5e88c750

Don't need defaultPriorityContext

Turns out this isn't necessary. Simpler to keep it as one field.

Andrew Clark committed Oct 30, 2016 at 22:34 UTC 2e5e88c750568b10dc1eebd7419a915750428097
1 file changed +4 -12
src/renderers/shared/fiber/ReactFiberScheduler.js
+4 -12
@@ -65,9 +65,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
65 const useSyncScheduling = config.useSyncScheduling;
66
67 // 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 ?
69 SynchronousPriority :
70 LowPriority;
71
@@ -591,9 +589,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
589
590 // We will process an update caused by each error boundary synchronously.
591 affectedBoundaries.forEach(boundary => {
594 - const priority = priorityContext !== null ?
595 - priorityContext :
596 - defaultPriorityContext;
592 + const priority = priorityContext;
593 const root = scheduleErrorBoundaryWork(boundary, priority);
594 // This should use findNextUnitOfWork() when synchronous scheduling is implemented.
595 let fiber = cloneFiber(root.current, priority);
@@ -628,9 +624,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
624
625 function scheduleWork(root : FiberRoot, priorityLevel : ?PriorityLevel) {
626 if (priorityLevel == null) {
631 - priorityLevel = priorityContext !== null ?
632 - priorityContext :
633 - defaultPriorityContext;
627 + priorityLevel = priorityContext;
628 }
629
630 if (priorityLevel === SynchronousPriority) {
@@ -650,9 +644,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
644 function scheduleUpdate(fiber: Fiber, priorityLevel : ?PriorityLevel): void {
645 // Use priority context if no priority is provided
646 if (priorityLevel == null) {
653 - priorityLevel = priorityContext !== null ?
654 - priorityContext :
655 - defaultPriorityContext;
647 + priorityLevel = priorityContext;
648 }
649
650 while (true) {