MCPcopy Create free account
hub / github.com/reactjs/react-rails / mountLazyComponent

Function mountLazyComponent

lib/assets/react-source/development/react.js:21011–21102  ·  view source on GitHub ↗
(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime)

Source from the content-addressed store, hash-verified

21009 }
21010
21011 function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
21012 if (_current !== null) {
21013 // A lazy component only mounts if it suspended inside a non-
21014 // concurrent tree, in an inconsistent state. We want to treat it like
21015 // a new mount, even though an empty version of it already committed.
21016 // Disconnect the alternate pointers.
21017 _current.alternate = null;
21018 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
21019
21020 workInProgress.effectTag |= Placement;
21021 }
21022
21023 var props = workInProgress.pendingProps; // We can't start a User Timing measurement with correct label yet.
21024 // Cancel and resume right after we know the tag.
21025
21026 cancelWorkTimer(workInProgress);
21027 var Component = readLazyComponentType(elementType); // Store the unwrapped component in the type.
21028
21029 workInProgress.type = Component;
21030 var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
21031 startWorkTimer(workInProgress);
21032 var resolvedProps = resolveDefaultProps(Component, props);
21033 var child;
21034
21035 switch (resolvedTag) {
21036 case FunctionComponent:
21037 {
21038 {
21039 validateFunctionComponentInDev(workInProgress, Component);
21040 workInProgress.type = Component = resolveFunctionForHotReloading(Component);
21041 }
21042
21043 child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
21044 return child;
21045 }
21046
21047 case ClassComponent:
21048 {
21049 {
21050 workInProgress.type = Component = resolveClassForHotReloading(Component);
21051 }
21052
21053 child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
21054 return child;
21055 }
21056
21057 case ForwardRef:
21058 {
21059 {
21060 workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
21061 }
21062
21063 child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
21064 return child;
21065 }
21066
21067 case MemoComponent:
21068 {

Callers 1

beginWorkFunction · 0.85

Calls 15

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