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

Function commitWork

code/communication/public/app.js:11851–11898  ·  view source on GitHub ↗
(current, finishedWork)

Source from the content-addressed store, hash-verified

11849 }
11850
11851 function commitWork(current, finishedWork) {
11852 switch (finishedWork.tag) {
11853 case ClassComponent:
11854 {
11855 return;
11856 }
11857 case HostComponent:
11858 {
11859 var _instance7 = finishedWork.stateNode;
11860 if (_instance7 != null) {
11861 // Commit the work prepared earlier.
11862 var newProps = finishedWork.memoizedProps;
11863 // For hydration we reuse the update path but we treat the oldProps
11864 // as the newProps. The updatePayload will contain the real change in
11865 // this case.
11866 var oldProps = current !== null ? current.memoizedProps : newProps;
11867 var type = finishedWork.type;
11868 // TODO: Type the updateQueue to be specific to host components.
11869 var updatePayload = finishedWork.updateQueue;
11870 finishedWork.updateQueue = null;
11871 if (updatePayload !== null) {
11872 commitUpdate(_instance7, updatePayload, type, oldProps, newProps, finishedWork);
11873 }
11874 }
11875 return;
11876 }
11877 case HostText:
11878 {
11879 !(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;
11880 var textInstance = finishedWork.stateNode;
11881 var newText = finishedWork.memoizedProps;
11882 // For hydration we reuse the update path but we treat the oldProps
11883 // as the newProps. The updatePayload will contain the real change in
11884 // this case.
11885 var oldText = current !== null ? current.memoizedProps : newText;
11886 commitTextUpdate(textInstance, oldText, newText);
11887 return;
11888 }
11889 case HostRoot:
11890 {
11891 return;
11892 }
11893 default:
11894 {
11895 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.');
11896 }
11897 }
11898 }
11899
11900 function commitResetTextContent(current) {
11901 resetTextContent(current.stateNode);

Callers 1

commitAllHostEffectsFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected