MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / commitAllHostEffects

Function commitAllHostEffects

code/new-context-api/public/app.js:12175–12242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12173 }
12174
12175 function commitAllHostEffects() {
12176 while (nextEffect !== null) {
12177 {
12178 ReactDebugCurrentFiber.setCurrentFiber(nextEffect);
12179 }
12180 recordEffect();
12181
12182 var effectTag = nextEffect.effectTag;
12183 if (effectTag & ContentReset) {
12184 commitResetTextContent(nextEffect);
12185 }
12186
12187 if (effectTag & Ref) {
12188 var current = nextEffect.alternate;
12189 if (current !== null) {
12190 commitDetachRef(current);
12191 }
12192 }
12193
12194 // The following switch statement is only concerned about placement,
12195 // updates, and deletions. To avoid needing to add a case for every
12196 // possible bitmap value, we remove the secondary effects from the
12197 // effect tag and switch on that value.
12198 var primaryEffectTag = effectTag & (Placement | Update | Deletion);
12199 switch (primaryEffectTag) {
12200 case Placement:
12201 {
12202 commitPlacement(nextEffect);
12203 // Clear the "placement" from effect tag so that we know that this is inserted, before
12204 // any life-cycles like componentDidMount gets called.
12205 // TODO: findDOMNode doesn't rely on this any more but isMounted
12206 // does and isMounted is deprecated anyway so we should be able
12207 // to kill this.
12208 nextEffect.effectTag &= ~Placement;
12209 break;
12210 }
12211 case PlacementAndUpdate:
12212 {
12213 // Placement
12214 commitPlacement(nextEffect);
12215 // Clear the "placement" from effect tag so that we know that this is inserted, before
12216 // any life-cycles like componentDidMount gets called.
12217 nextEffect.effectTag &= ~Placement;
12218
12219 // Update
12220 var _current = nextEffect.alternate;
12221 commitWork(_current, nextEffect);
12222 break;
12223 }
12224 case Update:
12225 {
12226 var _current2 = nextEffect.alternate;
12227 commitWork(_current2, nextEffect);
12228 break;
12229 }
12230 case Deletion:
12231 {
12232 commitDeletion(nextEffect);

Callers

nothing calls this directly

Calls 6

recordEffectFunction · 0.70
commitResetTextContentFunction · 0.70
commitDetachRefFunction · 0.70
commitPlacementFunction · 0.70
commitWorkFunction · 0.70
commitDeletionFunction · 0.70

Tested by

no test coverage detected