Skip to content

Commit cd91454

Browse files
committed
Centralize the pointer updates in the scheduler
1 parent eaf1ae0 commit cd91454

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/renderers/shared/fiber/ReactFiberBeginWork.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,6 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
725725
return bailoutOnLowPriority(current, workInProgress);
726726
}
727727

728-
if (__DEV__) {
729-
ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
730-
}
731-
732728
switch (workInProgress.tag) {
733729
case IndeterminateComponent:
734730
return mountIndeterminateComponent(

src/renderers/shared/fiber/ReactFiberCompleteWork.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ var {
4242
var {Placement, Ref, Update} = ReactTypeOfSideEffect;
4343
var {OffscreenPriority} = ReactPriorityLevel;
4444

45-
if (__DEV__) {
46-
var ReactDebugCurrentFiber = require('ReactDebugCurrentFiber');
47-
}
48-
4945
var invariant = require('fbjs/lib/invariant');
5046

5147
module.exports = function<T, P, I, TI, PI, C, CX, PL>(
@@ -187,10 +183,6 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
187183
workInProgress: Fiber,
188184
renderPriority: PriorityLevel,
189185
): Fiber | null {
190-
if (__DEV__) {
191-
ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
192-
}
193-
194186
// Get the latest props.
195187
let newProps = workInProgress.pendingProps;
196188
if (newProps === null) {

src/renderers/shared/fiber/ReactFiberScheduler.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,13 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
615615
// means that we don't need an additional field on the work in
616616
// progress.
617617
const current = workInProgress.alternate;
618+
if (__DEV__) {
619+
ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
620+
}
618621
const next = completeWork(current, workInProgress, nextPriorityLevel);
622+
if (__DEV__) {
623+
ReactDebugCurrentFiber.resetCurrentFiber();
624+
}
619625

620626
const returnFiber = workInProgress.return;
621627
const siblingFiber = workInProgress.sibling;
@@ -706,8 +712,12 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
706712
// See if beginning this work spawns more work.
707713
if (__DEV__) {
708714
startWorkTimer(workInProgress);
715+
ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
709716
}
710717
let next = beginWork(current, workInProgress, nextPriorityLevel);
718+
if (__DEV__) {
719+
ReactDebugCurrentFiber.resetCurrentFiber();
720+
}
711721
if (__DEV__ && ReactFiberInstrumentation.debugTool) {
712722
ReactFiberInstrumentation.debugTool.onBeginWork(workInProgress);
713723
}
@@ -718,9 +728,6 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
718728
}
719729

720730
ReactCurrentOwner.current = null;
721-
if (__DEV__) {
722-
ReactDebugCurrentFiber.resetCurrentFiber();
723-
}
724731

725732
return next;
726733
}
@@ -735,6 +742,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
735742
// See if beginning this work spawns more work.
736743
if (__DEV__) {
737744
startWorkTimer(workInProgress);
745+
ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
738746
}
739747
let next = beginFailedWork(current, workInProgress, nextPriorityLevel);
740748
if (__DEV__ && ReactFiberInstrumentation.debugTool) {

0 commit comments

Comments
 (0)