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

Function commitRoot

code/composition/public/app.js:13071–13183  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

13069 }
13070
13071 function commitRoot(finishedWork) {
13072 isWorking = true;
13073 isCommitting = true;
13074 startCommitTimer();
13075
13076 var root = finishedWork.stateNode;
13077 !(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;
13078 var committedExpirationTime = root.pendingCommitExpirationTime;
13079 !(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;
13080 root.pendingCommitExpirationTime = NoWork;
13081
13082 var currentTime = recalculateCurrentTime();
13083
13084 // Reset this to null before calling lifecycles
13085 ReactCurrentOwner.current = null;
13086
13087 var firstEffect = void 0;
13088 if (finishedWork.effectTag > PerformedWork) {
13089 // A fiber's effect list consists only of its children, not itself. So if
13090 // the root has an effect, we need to add it to the end of the list. The
13091 // resulting list is the set that would belong to the root's parent, if
13092 // it had one; that is, all the effects in the tree including the root.
13093 if (finishedWork.lastEffect !== null) {
13094 finishedWork.lastEffect.nextEffect = finishedWork;
13095 firstEffect = finishedWork.firstEffect;
13096 } else {
13097 firstEffect = finishedWork;
13098 }
13099 } else {
13100 // There is no effect on the root.
13101 firstEffect = finishedWork.firstEffect;
13102 }
13103
13104 prepareForCommit(root.containerInfo);
13105
13106 // Commit all the side-effects within a tree. We'll do this in two passes.
13107 // The first pass performs all the host insertions, updates, deletions and
13108 // ref unmounts.
13109 nextEffect = firstEffect;
13110 startCommitHostEffectsTimer();
13111 while (nextEffect !== null) {
13112 var didError = false;
13113 var error = void 0;
13114 {
13115 invokeGuardedCallback$2(null, commitAllHostEffects, null);
13116 if (hasCaughtError()) {
13117 didError = true;
13118 error = clearCaughtError();
13119 }
13120 }
13121 if (didError) {
13122 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13123 onCommitPhaseError(nextEffect, error);
13124 // Clean-up
13125 if (nextEffect !== null) {
13126 nextEffect = nextEffect.nextEffect;
13127 }
13128 }

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