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

Function commitWork

code/dependency-injection/public/app.js:11909–11956  ·  view source on GitHub ↗
(current, finishedWork)

Source from the content-addressed store, hash-verified

11907 }
11908
11909 function commitWork(current, finishedWork) {
11910 switch (finishedWork.tag) {
11911 case ClassComponent:
11912 {
11913 return;
11914 }
11915 case HostComponent:
11916 {
11917 var _instance7 = finishedWork.stateNode;
11918 if (_instance7 != null) {
11919 // Commit the work prepared earlier.
11920 var newProps = finishedWork.memoizedProps;
11921 // For hydration we reuse the update path but we treat the oldProps
11922 // as the newProps. The updatePayload will contain the real change in
11923 // this case.
11924 var oldProps = current !== null ? current.memoizedProps : newProps;
11925 var type = finishedWork.type;
11926 // TODO: Type the updateQueue to be specific to host components.
11927 var updatePayload = finishedWork.updateQueue;
11928 finishedWork.updateQueue = null;
11929 if (updatePayload !== null) {
11930 commitUpdate(_instance7, updatePayload, type, oldProps, newProps, finishedWork);
11931 }
11932 }
11933 return;
11934 }
11935 case HostText:
11936 {
11937 !(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;
11938 var textInstance = finishedWork.stateNode;
11939 var newText = finishedWork.memoizedProps;
11940 // For hydration we reuse the update path but we treat the oldProps
11941 // as the newProps. The updatePayload will contain the real change in
11942 // this case.
11943 var oldText = current !== null ? current.memoizedProps : newText;
11944 commitTextUpdate(textInstance, oldText, newText);
11945 return;
11946 }
11947 case HostRoot:
11948 {
11949 return;
11950 }
11951 default:
11952 {
11953 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.');
11954 }
11955 }
11956 }
11957
11958 function commitResetTextContent(current) {
11959 resetTextContent(current.stateNode);

Callers 1

commitAllHostEffectsFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected