Skip to content

Commit

Permalink
Don't need defaultPriorityContext
Browse files Browse the repository at this point in the history
Turns out this isn't necessary. Simpler to keep it as one field.
  • Loading branch information
acdlite committed Oct 31, 2016
1 parent 8996c9c commit b44da09
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/renderers/shared/fiber/ReactFiberScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
const useSyncScheduling = config.useSyncScheduling;

// The priority level to use when scheduling an update.
let priorityContext : (PriorityLevel | null) = null;
// The priority level to use if there is no priority context.
let defaultPriorityContext : PriorityLevel = useSyncScheduling ?
let priorityContext : PriorityLevel = useSyncScheduling ?
SynchronousPriority :
LowPriority;

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

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

function scheduleWork(root : FiberRoot, priorityLevel : ?PriorityLevel) {
if (priorityLevel == null) {
priorityLevel = priorityContext !== null ?
priorityContext :
defaultPriorityContext;
priorityLevel = priorityContext;
}

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

while (true) {
Expand Down

0 comments on commit b44da09

Please sign in to comment.