MCPcopy Create free account
hub / github.com/microsoft/SandDance / mountLazyComponent

Function mountLazyComponent

docs/external/js/react-dom.development.js:17451–17542  ·  view source on GitHub ↗
(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime)

Source from the content-addressed store, hash-verified

17449 }
17450
17451 function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
17452 if (_current !== null) {
17453 // A lazy component only mounts if it suspended inside a non-
17454 // concurrent tree, in an inconsistent state. We want to treat it like
17455 // a new mount, even though an empty version of it already committed.
17456 // Disconnect the alternate pointers.
17457 _current.alternate = null;
17458 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
17459
17460 workInProgress.effectTag |= Placement;
17461 }
17462
17463 var props = workInProgress.pendingProps; // We can't start a User Timing measurement with correct label yet.
17464 // Cancel and resume right after we know the tag.
17465
17466 cancelWorkTimer(workInProgress);
17467 var Component = readLazyComponentType(elementType); // Store the unwrapped component in the type.
17468
17469 workInProgress.type = Component;
17470 var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
17471 startWorkTimer(workInProgress);
17472 var resolvedProps = resolveDefaultProps(Component, props);
17473 var child;
17474
17475 switch (resolvedTag) {
17476 case FunctionComponent:
17477 {
17478 {
17479 validateFunctionComponentInDev(workInProgress, Component);
17480 workInProgress.type = Component = resolveFunctionForHotReloading(Component);
17481 }
17482
17483 child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
17484 return child;
17485 }
17486
17487 case ClassComponent:
17488 {
17489 {
17490 workInProgress.type = Component = resolveClassForHotReloading(Component);
17491 }
17492
17493 child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
17494 return child;
17495 }
17496
17497 case ForwardRef:
17498 {
17499 {
17500 workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
17501 }
17502
17503 child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
17504 return child;
17505 }
17506
17507 case MemoComponent:
17508 {

Callers 1

beginWorkFunction · 0.85

Calls 14

cancelWorkTimerFunction · 0.85
readLazyComponentTypeFunction · 0.85
resolveLazyComponentTagFunction · 0.85
startWorkTimerFunction · 0.85
resolveDefaultPropsFunction · 0.85
updateFunctionComponentFunction · 0.85
updateClassComponentFunction · 0.85
updateForwardRefFunction · 0.85

Tested by

no test coverage detected