MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / mountIndeterminateComponent

Function mountIndeterminateComponent

code/composition/public/app.js:10224–10311  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10222 }
10223
10224 function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) {
10225 !(current === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0;
10226 var fn = workInProgress.type;
10227 var props = workInProgress.pendingProps;
10228 var unmaskedContext = getUnmaskedContext(workInProgress);
10229 var context = getMaskedContext(workInProgress, unmaskedContext);
10230
10231 var value = void 0;
10232
10233 {
10234 if (fn.prototype && typeof fn.prototype.render === 'function') {
10235 var componentName = getComponentName(workInProgress) || 'Unknown';
10236
10237 if (!didWarnAboutBadClass[componentName]) {
10238 warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
10239 didWarnAboutBadClass[componentName] = true;
10240 }
10241 }
10242 ReactCurrentOwner.current = workInProgress;
10243 value = fn(props, context);
10244 }
10245 // React DevTools reads this flag.
10246 workInProgress.effectTag |= PerformedWork;
10247
10248 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
10249 var Component = workInProgress.type;
10250
10251 // Proceed under the assumption that this is a class instance
10252 workInProgress.tag = ClassComponent;
10253
10254 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
10255
10256 if (typeof Component.getDerivedStateFromProps === 'function') {
10257 var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState);
10258
10259 if (partialState !== null && partialState !== undefined) {
10260 workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState);
10261 }
10262 }
10263
10264 // Push context providers early to prevent context stack mismatches.
10265 // During mounting we don't know the child context yet as the instance doesn't exist.
10266 // We will invalidate the child context in finishClassComponent() right after rendering.
10267 var hasContext = pushLegacyContextProvider(workInProgress);
10268 adoptClassInstance(workInProgress, value);
10269 mountClassInstance(workInProgress, renderExpirationTime);
10270 return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime);
10271 } else {
10272 // Proceed under the assumption that this is a functional component
10273 workInProgress.tag = FunctionalComponent;
10274 {
10275 var _Component = workInProgress.type;
10276
10277 if (_Component) {
10278 warning(!_Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component');
10279 }
10280 if (workInProgress.ref !== null) {
10281 var info = '';

Callers 1

beginWorkFunction · 0.70

Calls 11

warningFunction · 0.85
invariantFunction · 0.70
getUnmaskedContextFunction · 0.70
getMaskedContextFunction · 0.70
getComponentNameFunction · 0.70
adoptClassInstanceFunction · 0.70
mountClassInstanceFunction · 0.70
finishClassComponentFunction · 0.70
reconcileChildrenFunction · 0.70
memoizePropsFunction · 0.70

Tested by

no test coverage detected