MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / commitWork

Function commitWork

bundle.js:7599–7607  ·  view source on GitHub ↗
(current,finishedWork)

Source from the content-addressed store, hash-verified

7597// We are also not using this parent because
7598// the portal will get pushed immediately.
7599unmountHostComponents(current);return;}}}function commitWork(current,finishedWork){switch(finishedWork.tag){case ClassComponent$9:{return;}case HostComponent$9:{var instance=finishedWork.stateNode;if(instance!=null){// Commit the work prepared earlier.
7600var newProps=finishedWork.memoizedProps;// For hydration we reuse the update path but we treat the oldProps
7601// as the newProps. The updatePayload will contain the real change in
7602// this case.
7603var oldProps=current!==null?current.memoizedProps:newProps;var type=finishedWork.type;// TODO: Type the updateQueue to be specific to host components.
7604var updatePayload=finishedWork.updateQueue;finishedWork.updateQueue=null;if(updatePayload!==null){commitUpdate(instance,updatePayload,type,oldProps,newProps,finishedWork);}}return;}case HostText$7:{!(finishedWork.stateNode!==null)?invariant(false,'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.'):void 0;var textInstance=finishedWork.stateNode;var newText=finishedWork.memoizedProps;// For hydration we reuse the update path but we treat the oldProps
7605// as the newProps. The updatePayload will contain the real change in
7606// this case.
7607var oldText=current!==null?current.memoizedProps:newText;commitTextUpdate(textInstance,oldText,newText);return;}case HostRoot$9:{return;}case HostPortal$7:{return;}default:{invariant(false,'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');}}}function commitLifeCycles(current,finishedWork){switch(finishedWork.tag){case ClassComponent$9:{var instance=finishedWork.stateNode;if(finishedWork.effectTag&Update$3){if(current===null){{startPhaseTimer$2(finishedWork,'componentDidMount');}instance.props=finishedWork.memoizedProps;instance.state=finishedWork.memoizedState;instance.componentDidMount();{stopPhaseTimer$2();}}else{var prevProps=current.memoizedProps;var prevState=current.memoizedState;{startPhaseTimer$2(finishedWork,'componentDidUpdate');}instance.props=finishedWork.memoizedProps;instance.state=finishedWork.memoizedState;instance.componentDidUpdate(prevProps,prevState);{stopPhaseTimer$2();}}}if(finishedWork.effectTag&Callback$1&&finishedWork.updateQueue!==null){commitCallbacks$1(finishedWork,finishedWork.updateQueue,instance);}return;}case HostRoot$9:{var updateQueue=finishedWork.updateQueue;if(updateQueue!==null){var _instance=finishedWork.child&&finishedWork.child.stateNode;commitCallbacks$1(finishedWork,updateQueue,_instance);}return;}case HostComponent$9:{var _instance2=finishedWork.stateNode;// Renderers may schedule work to be done after host components are mounted
7608// (eg DOM renderer may schedule auto-focus for inputs and form controls).
7609// These effects should only be committed when components are first mounted,
7610// aka when there is no current/alternate.

Callers 1

commitAllHostEffectsFunction · 0.85

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected