Skip to content

Commit ea083dc

Browse files
committed
Updates from inside componentDidMount/Update should have Task priority.
This is only observable in incremental mode.
1 parent 4266f08 commit ea083dc

File tree

4 files changed

+68
-382
lines changed

4 files changed

+68
-382
lines changed

scripts/fiber/tests-passing.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -820,18 +820,6 @@ src/renderers/shared/fiber/__tests__/ReactIncrementalScheduling-test.js
820820
* splits deferred work on multiple roots
821821
* works on deferred roots in the order they were scheduled
822822
* handles interleaved deferred and animation work
823-
* performs animation work in animation callback
824-
* schedules deferred work in animation callback
825-
* schedules deferred work and performs animation work in animation callback
826-
* performs animation work and schedules deferred work in animation callback
827-
* performs deferred work in deferred callback if it has time
828-
* schedules deferred work in deferred callback if it runs out of time
829-
* performs animated work in deferred callback if it has time
830-
* performs animated work and deferred work in deferred callback if it has time
831-
* performs deferred and animated work work in deferred callback if it has time
832-
* schedules animated work in deferred callback if it runs out of time
833-
* schedules animated work and deferred work in deferred callback if it runs out of time
834-
* schedules deferred work and animated work in deferred callback if it runs out of time
835823

836824
src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js
837825
* can update child nodes of a host instance
@@ -852,6 +840,7 @@ src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js
852840
* calls setState callback even if component bails out
853841
* calls componentWillUnmount after a deletion, even if nested
854842
* calls componentDidMount/Update after insertion/update
843+
* schedules sync updates when inside componentDidMount/Update
855844
* invokes ref callbacks after insertion/update/unmount
856845
* supports string refs
857846

src/renderers/shared/fiber/ReactFiberScheduler.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,13 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
208208
while (effectfulFiber) {
209209
if (effectfulFiber.effectTag & (Update | Callback)) {
210210
const current = effectfulFiber.alternate;
211-
commitLifeCycles(current, effectfulFiber);
211+
const previousPriorityContext = priorityContext;
212+
priorityContext = TaskPriority;
213+
try {
214+
commitLifeCycles(current, effectfulFiber);
215+
} finally {
216+
priorityContext = previousPriorityContext;
217+
}
212218
}
213219
const next = effectfulFiber.nextEffect;
214220
// Ensure that we clean these up so that we don't accidentally keep them.

0 commit comments

Comments
 (0)