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

Function commitWork

code/higher-order-components/public/app.js:11810–11857  ·  view source on GitHub ↗
(current, finishedWork)

Source from the content-addressed store, hash-verified

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

Callers 1

commitAllHostEffectsFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected