(lazyType: LazyComponentType<T, any>)
| 295 | } |
| 296 | |
| 297 | export function resolveLazy<T>(lazyType: LazyComponentType<T, any>): T { |
| 298 | try { |
| 299 | if (__DEV__) { |
| 300 | return callLazyInitInDEV(lazyType); |
| 301 | } |
| 302 | const payload = lazyType._payload; |
| 303 | const init = lazyType._init; |
| 304 | return init(payload); |
| 305 | } catch (x) { |
| 306 | if (x !== null && typeof x === 'object' && typeof x.then === 'function') { |
| 307 | // This lazy Suspended. Treat this as if we called use() to unwrap it. |
| 308 | suspendedThenable = x; |
| 309 | if (__DEV__) { |
| 310 | needsToResetSuspendedThenableDEV = true; |
| 311 | } |
| 312 | throw SuspenseException; |
| 313 | } |
| 314 | throw x; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | // This is used to track the actual thenable that suspended so it can be |
| 319 | // passed to the rest of the Suspense implementation — which, for historical |
no test coverage detected