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

Function commitAllHostEffects

code/third-party/public/app.js:12047–12114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12045 }
12046
12047 function commitAllHostEffects() {
12048 while (nextEffect !== null) {
12049 {
12050 ReactDebugCurrentFiber.setCurrentFiber(nextEffect);
12051 }
12052 recordEffect();
12053
12054 var effectTag = nextEffect.effectTag;
12055 if (effectTag & ContentReset) {
12056 commitResetTextContent(nextEffect);
12057 }
12058
12059 if (effectTag & Ref) {
12060 var current = nextEffect.alternate;
12061 if (current !== null) {
12062 commitDetachRef(current);
12063 }
12064 }
12065
12066 // The following switch statement is only concerned about placement,
12067 // updates, and deletions. To avoid needing to add a case for every
12068 // possible bitmap value, we remove the secondary effects from the
12069 // effect tag and switch on that value.
12070 var primaryEffectTag = effectTag & (Placement | Update | Deletion);
12071 switch (primaryEffectTag) {
12072 case Placement:
12073 {
12074 commitPlacement(nextEffect);
12075 // Clear the "placement" from effect tag so that we know that this is inserted, before
12076 // any life-cycles like componentDidMount gets called.
12077 // TODO: findDOMNode doesn't rely on this any more but isMounted
12078 // does and isMounted is deprecated anyway so we should be able
12079 // to kill this.
12080 nextEffect.effectTag &= ~Placement;
12081 break;
12082 }
12083 case PlacementAndUpdate:
12084 {
12085 // Placement
12086 commitPlacement(nextEffect);
12087 // Clear the "placement" from effect tag so that we know that this is inserted, before
12088 // any life-cycles like componentDidMount gets called.
12089 nextEffect.effectTag &= ~Placement;
12090
12091 // Update
12092 var _current = nextEffect.alternate;
12093 commitWork(_current, nextEffect);
12094 break;
12095 }
12096 case Update:
12097 {
12098 var _current2 = nextEffect.alternate;
12099 commitWork(_current2, nextEffect);
12100 break;
12101 }
12102 case Deletion:
12103 {
12104 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