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

Function commitWork

code/styling/public/app.js:11816–11863  ·  view source on GitHub ↗
(current, finishedWork)

Source from the content-addressed store, hash-verified

11814 }
11815
11816 function commitWork(current, finishedWork) {
11817 switch (finishedWork.tag) {
11818 case ClassComponent:
11819 {
11820 return;
11821 }
11822 case HostComponent:
11823 {
11824 var _instance7 = finishedWork.stateNode;
11825 if (_instance7 != null) {
11826 // Commit the work prepared earlier.
11827 var newProps = finishedWork.memoizedProps;
11828 // For hydration we reuse the update path but we treat the oldProps
11829 // as the newProps. The updatePayload will contain the real change in
11830 // this case.
11831 var oldProps = current !== null ? current.memoizedProps : newProps;
11832 var type = finishedWork.type;
11833 // TODO: Type the updateQueue to be specific to host components.
11834 var updatePayload = finishedWork.updateQueue;
11835 finishedWork.updateQueue = null;
11836 if (updatePayload !== null) {
11837 commitUpdate(_instance7, updatePayload, type, oldProps, newProps, finishedWork);
11838 }
11839 }
11840 return;
11841 }
11842 case HostText:
11843 {
11844 !(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;
11845 var textInstance = finishedWork.stateNode;
11846 var newText = finishedWork.memoizedProps;
11847 // For hydration we reuse the update path but we treat the oldProps
11848 // as the newProps. The updatePayload will contain the real change in
11849 // this case.
11850 var oldText = current !== null ? current.memoizedProps : newText;
11851 commitTextUpdate(textInstance, oldText, newText);
11852 return;
11853 }
11854 case HostRoot:
11855 {
11856 return;
11857 }
11858 default:
11859 {
11860 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.');
11861 }
11862 }
11863 }
11864
11865 function commitResetTextContent(current) {
11866 resetTextContent(current.stateNode);

Callers 1

commitAllHostEffectsFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected