From a2fa6eb98d11fd1b41a144fd600a14a722c7546e Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 18 Jan 2019 21:57:26 +0000 Subject: [PATCH] Move lazy._result assignment (#14632) --- packages/react-reconciler/src/ReactFiberLazyComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-reconciler/src/ReactFiberLazyComponent.js b/packages/react-reconciler/src/ReactFiberLazyComponent.js index 179262fa449c8..07fd7a70762de 100644 --- a/packages/react-reconciler/src/ReactFiberLazyComponent.js +++ b/packages/react-reconciler/src/ReactFiberLazyComponent.js @@ -47,7 +47,6 @@ export function readLazyComponentType(lazyComponent: LazyComponent): 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(lazyComponent: LazyComponent): T { if (lazyComponent._status === Resolved) { return lazyComponent._result; } + lazyComponent._result = thenable; throw thenable; } }