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

Function mountIndeterminateComponent

code/third-party/public/app.js:9319–9406  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9317 }
9318
9319 function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) {
9320 !(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;
9321 var fn = workInProgress.type;
9322 var props = workInProgress.pendingProps;
9323 var unmaskedContext = getUnmaskedContext(workInProgress);
9324 var context = getMaskedContext(workInProgress, unmaskedContext);
9325
9326 var value = void 0;
9327
9328 {
9329 if (fn.prototype && typeof fn.prototype.render === 'function') {
9330 var componentName = getComponentName(workInProgress) || 'Unknown';
9331
9332 if (!didWarnAboutBadClass[componentName]) {
9333 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);
9334 didWarnAboutBadClass[componentName] = true;
9335 }
9336 }
9337 ReactCurrentOwner.current = workInProgress;
9338 value = fn(props, context);
9339 }
9340 // React DevTools reads this flag.
9341 workInProgress.effectTag |= PerformedWork;
9342
9343 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
9344 var Component = workInProgress.type;
9345
9346 // Proceed under the assumption that this is a class instance
9347 workInProgress.tag = ClassComponent;
9348
9349 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
9350
9351 if (typeof Component.getDerivedStateFromProps === 'function') {
9352 var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState);
9353
9354 if (partialState !== null && partialState !== undefined) {
9355 workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState);
9356 }
9357 }
9358
9359 // Push context providers early to prevent context stack mismatches.
9360 // During mounting we don't know the child context yet as the instance doesn't exist.
9361 // We will invalidate the child context in finishClassComponent() right after rendering.
9362 var hasContext = pushLegacyContextProvider(workInProgress);
9363 adoptClassInstance(workInProgress, value);
9364 mountClassInstance(workInProgress, renderExpirationTime);
9365 return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime);
9366 } else {
9367 // Proceed under the assumption that this is a functional component
9368 workInProgress.tag = FunctionalComponent;
9369 {
9370 var _Component = workInProgress.type;
9371
9372 if (_Component) {
9373 warning(!_Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component');
9374 }
9375 if (workInProgress.ref !== null) {
9376 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