MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / commitRoot

Function commitRoot

code/redux/public/app.js:13184–13296  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

13182 }
13183
13184 function commitRoot(finishedWork) {
13185 isWorking = true;
13186 isCommitting = true;
13187 startCommitTimer();
13188
13189 var root = finishedWork.stateNode;
13190 !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13191 var committedExpirationTime = root.pendingCommitExpirationTime;
13192 !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13193 root.pendingCommitExpirationTime = NoWork;
13194
13195 var currentTime = recalculateCurrentTime();
13196
13197 // Reset this to null before calling lifecycles
13198 ReactCurrentOwner.current = null;
13199
13200 var firstEffect = void 0;
13201 if (finishedWork.effectTag > PerformedWork) {
13202 // A fiber's effect list consists only of its children, not itself. So if
13203 // the root has an effect, we need to add it to the end of the list. The
13204 // resulting list is the set that would belong to the root's parent, if
13205 // it had one; that is, all the effects in the tree including the root.
13206 if (finishedWork.lastEffect !== null) {
13207 finishedWork.lastEffect.nextEffect = finishedWork;
13208 firstEffect = finishedWork.firstEffect;
13209 } else {
13210 firstEffect = finishedWork;
13211 }
13212 } else {
13213 // There is no effect on the root.
13214 firstEffect = finishedWork.firstEffect;
13215 }
13216
13217 prepareForCommit(root.containerInfo);
13218
13219 // Commit all the side-effects within a tree. We'll do this in two passes.
13220 // The first pass performs all the host insertions, updates, deletions and
13221 // ref unmounts.
13222 nextEffect = firstEffect;
13223 startCommitHostEffectsTimer();
13224 while (nextEffect !== null) {
13225 var didError = false;
13226 var error = void 0;
13227 {
13228 invokeGuardedCallback$2(null, commitAllHostEffects, null);
13229 if (hasCaughtError()) {
13230 didError = true;
13231 error = clearCaughtError();
13232 }
13233 }
13234 if (didError) {
13235 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13236 onCommitPhaseError(nextEffect, error);
13237 // Clean-up
13238 if (nextEffect !== null) {
13239 nextEffect = nextEffect.nextEffect;
13240 }
13241 }

Callers 1

completeRootFunction · 0.70

Calls 10

startCommitTimerFunction · 0.70
invariantFunction · 0.70
recalculateCurrentTimeFunction · 0.70
onCommitPhaseErrorFunction · 0.70
stopCommitTimerFunction · 0.70
onCommitRootFunction · 0.70

Tested by

no test coverage detected