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

Function commitWork

code/composition/public/app.js:11954–12001  ·  view source on GitHub ↗
(current, finishedWork)

Source from the content-addressed store, hash-verified

11952 }
11953
11954 function commitWork(current, finishedWork) {
11955 switch (finishedWork.tag) {
11956 case ClassComponent:
11957 {
11958 return;
11959 }
11960 case HostComponent:
11961 {
11962 var _instance7 = finishedWork.stateNode;
11963 if (_instance7 != null) {
11964 // Commit the work prepared earlier.
11965 var newProps = finishedWork.memoizedProps;
11966 // For hydration we reuse the update path but we treat the oldProps
11967 // as the newProps. The updatePayload will contain the real change in
11968 // this case.
11969 var oldProps = current !== null ? current.memoizedProps : newProps;
11970 var type = finishedWork.type;
11971 // TODO: Type the updateQueue to be specific to host components.
11972 var updatePayload = finishedWork.updateQueue;
11973 finishedWork.updateQueue = null;
11974 if (updatePayload !== null) {
11975 commitUpdate(_instance7, updatePayload, type, oldProps, newProps, finishedWork);
11976 }
11977 }
11978 return;
11979 }
11980 case HostText:
11981 {
11982 !(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;
11983 var textInstance = finishedWork.stateNode;
11984 var newText = finishedWork.memoizedProps;
11985 // For hydration we reuse the update path but we treat the oldProps
11986 // as the newProps. The updatePayload will contain the real change in
11987 // this case.
11988 var oldText = current !== null ? current.memoizedProps : newText;
11989 commitTextUpdate(textInstance, oldText, newText);
11990 return;
11991 }
11992 case HostRoot:
11993 {
11994 return;
11995 }
11996 default:
11997 {
11998 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.');
11999 }
12000 }
12001 }
12002
12003 function commitResetTextContent(current) {
12004 resetTextContent(current.stateNode);

Callers 1

commitAllHostEffectsFunction · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected