mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Move lazy._result assignment (#14632)
This commit is contained in:
@@ -47,7 +47,6 @@ export function readLazyComponentType<T>(lazyComponent: LazyComponent<T>): T {
|
||||
lazyComponent._status = Pending;
|
||||
const ctor = lazyComponent._ctor;
|
||||
const thenable = ctor();
|
||||
lazyComponent._result = thenable;
|
||||
thenable.then(
|
||||
moduleObject => {
|
||||
if (lazyComponent._status === Pending) {
|
||||
@@ -78,6 +77,7 @@ export function readLazyComponentType<T>(lazyComponent: LazyComponent<T>): T {
|
||||
if (lazyComponent._status === Resolved) {
|
||||
return lazyComponent._result;
|
||||
}
|
||||
lazyComponent._result = thenable;
|
||||
throw thenable;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user