(response, chunk)
| 993 | // Initialize any debug info and block the initializing chunk on any |
| 994 | // unresolved entries. |
| 995 | initializeDebugChunk(response, chunk); |
| 996 | } |
| 997 | |
| 998 | try { |
| 999 | const value: T = parseModel(response, resolvedModel); |
| 1000 | // Invoke any listeners added while resolving this model. I.e. cyclic |
| 1001 | // references. This may or may not fully resolve the model depending on |
| 1002 | // if they were blocked. |
| 1003 | const resolveListeners = cyclicChunk.value; |
| 1004 | if (resolveListeners !== null) { |
| 1005 | cyclicChunk.value = null; |
| 1006 | cyclicChunk.reason = null; |
| 1007 | for (let i = 0; i < resolveListeners.length; i++) { |
| 1008 | const listener = resolveListeners[i]; |
| 1009 | if (typeof listener === 'function') { |
| 1010 | listener(value); |
| 1011 | } else { |
| 1012 | fulfillReference(listener, value, cyclicChunk); |
| 1013 | } |
| 1014 | } |
| 1015 | } |
| 1016 | if (initializingHandler !== null) { |
| 1017 | if (initializingHandler.errored) { |
| 1018 | throw initializingHandler.reason; |
| 1019 | } |
| 1020 | if (initializingHandler.deps > 0) { |
| 1021 | // We discovered new dependencies on modules that are not yet resolved. |
| 1022 | // We have to keep the BLOCKED state until they're resolved. |
| 1023 | initializingHandler.value = value; |
| 1024 | initializingHandler.chunk = cyclicChunk; |
| 1025 | return; |
| 1026 | } |
| 1027 | } |
| 1028 | const initializedChunk: InitializedChunk<T> = (chunk: any); |
| 1029 | initializedChunk.status = INITIALIZED; |
| 1030 | initializedChunk.value = value; |
| 1031 | |
| 1032 | if (__DEV__) { |
| 1033 | moveDebugInfoFromChunkToInnerValue(initializedChunk, value); |
| 1034 | } |
| 1035 | } catch (error) { |
| 1036 | const erroredChunk: ErroredChunk<T> = (chunk: any); |
| 1037 | erroredChunk.status = ERRORED; |
| 1038 | erroredChunk.reason = error; |
no test coverage detected