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

Function commitAllHostEffects

code/event-handlers/public/app.js:12144–12211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12142 }
12143
12144 function commitAllHostEffects() {
12145 while (nextEffect !== null) {
12146 {
12147 ReactDebugCurrentFiber.setCurrentFiber(nextEffect);
12148 }
12149 recordEffect();
12150
12151 var effectTag = nextEffect.effectTag;
12152 if (effectTag & ContentReset) {
12153 commitResetTextContent(nextEffect);
12154 }
12155
12156 if (effectTag & Ref) {
12157 var current = nextEffect.alternate;
12158 if (current !== null) {
12159 commitDetachRef(current);
12160 }
12161 }
12162
12163 // The following switch statement is only concerned about placement,
12164 // updates, and deletions. To avoid needing to add a case for every
12165 // possible bitmap value, we remove the secondary effects from the
12166 // effect tag and switch on that value.
12167 var primaryEffectTag = effectTag & (Placement | Update | Deletion);
12168 switch (primaryEffectTag) {
12169 case Placement:
12170 {
12171 commitPlacement(nextEffect);
12172 // Clear the "placement" from effect tag so that we know that this is inserted, before
12173 // any life-cycles like componentDidMount gets called.
12174 // TODO: findDOMNode doesn't rely on this any more but isMounted
12175 // does and isMounted is deprecated anyway so we should be able
12176 // to kill this.
12177 nextEffect.effectTag &= ~Placement;
12178 break;
12179 }
12180 case PlacementAndUpdate:
12181 {
12182 // Placement
12183 commitPlacement(nextEffect);
12184 // Clear the "placement" from effect tag so that we know that this is inserted, before
12185 // any life-cycles like componentDidMount gets called.
12186 nextEffect.effectTag &= ~Placement;
12187
12188 // Update
12189 var _current = nextEffect.alternate;
12190 commitWork(_current, nextEffect);
12191 break;
12192 }
12193 case Update:
12194 {
12195 var _current2 = nextEffect.alternate;
12196 commitWork(_current2, nextEffect);
12197 break;
12198 }
12199 case Deletion:
12200 {
12201 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