68
SuspenseActionException,
69
createThenableState,
70
trackUsedThenable,
71
+ resolveLazy,
72
} from './ReactFiberThenable';
73
import {readContextDuringReconciliation} from './ReactFiberNewContext';
73
-import {callLazyInitInDEV} from './ReactFiberCallUserSpace';
74
75
import {runWithFiberInDEV} from './ReactCurrentFiber';
76
364
}
365
}
366
367
-function resolveLazy(lazyType: any) {
368
- if (__DEV__) {
369
- return callLazyInitInDEV(lazyType);
370
- }
371
- const payload = lazyType._payload;
372
- const init = lazyType._init;
373
- return init(payload);
374
-}
375
-
367
type ChildReconciler = (
368
returnFiber: Fiber,
369
currentFirstChild: Fiber | null,
689
}
690
case REACT_LAZY_TYPE: {
691
const prevDebugInfo = pushDebugInfo(newChild._debugInfo);
701
- let resolvedChild;
702
- if (__DEV__) {
703
- resolvedChild = callLazyInitInDEV(newChild);
704
- } else {
705
- const payload = newChild._payload;
706
- const init = newChild._init;
707
- resolvedChild = init(payload);
708
- }
692
+ const resolvedChild = resolveLazy((newChild: any));
693
const created = createChild(returnFiber, resolvedChild, lanes);
694
currentDebugInfo = prevDebugInfo;
695
return created;
814
}
815
case REACT_LAZY_TYPE: {
816
const prevDebugInfo = pushDebugInfo(newChild._debugInfo);
833
- let resolvedChild;
834
- if (__DEV__) {
835
- resolvedChild = callLazyInitInDEV(newChild);
836
- } else {
837
- const payload = newChild._payload;
838
- const init = newChild._init;
839
- resolvedChild = init(payload);
840
- }
817
+ const resolvedChild = resolveLazy((newChild: any));
818
const updated = updateSlot(
819
returnFiber,
820
oldFiber,
939
}
940
case REACT_LAZY_TYPE: {
941
const prevDebugInfo = pushDebugInfo(newChild._debugInfo);
965
- let resolvedChild;
966
- if (__DEV__) {
967
- resolvedChild = callLazyInitInDEV(newChild);
968
- } else {
969
- const payload = newChild._payload;
970
- const init = newChild._init;
971
- resolvedChild = init(payload);
972
- }
942
+ const resolvedChild = resolveLazy((newChild: any));
943
const updated = updateFromMap(
944
existingChildren,
945
returnFiber,
1056
});
1057
break;
1058
case REACT_LAZY_TYPE: {
1089
- let resolvedChild;
1090
- if (__DEV__) {
1091
- resolvedChild = callLazyInitInDEV((child: any));
1092
- } else {
1093
- const payload = child._payload;
1094
- const init = (child._init: any);
1095
- resolvedChild = init(payload);
1096
- }
1059
+ const resolvedChild = resolveLazy((child: any));
1060
warnOnInvalidKey(
1061
returnFiber,
1062
workInProgress,
1772
);
1773
case REACT_LAZY_TYPE: {
1774
const prevDebugInfo = pushDebugInfo(newChild._debugInfo);
1812
- let result;
1813
- if (__DEV__) {
1814
- result = callLazyInitInDEV(newChild);
1815
- } else {
1816
- const payload = newChild._payload;
1817
- const init = newChild._init;
1818
- result = init(payload);
1819
- }
1775
+ const result = resolveLazy((newChild: any));
1776
const firstChild = reconcileChildFibersImpl(
1777
returnFiber,
1778
currentFirstChild,