|
1 | 1 | import { Injector, ReflectiveInjector } from '../di'; |
2 | 2 | import { ResolvedProvider } from '../di/resolution'; |
3 | 3 | import { ID } from '../shared/types'; |
4 | | -import { once } from '../shared/utils'; |
| 4 | +import { once, merge } from '../shared/utils'; |
5 | 5 | import type { InternalAppContext, ModulesMap } from './application'; |
6 | 6 | import { attachGlobalProvidersMap } from './di'; |
7 | 7 | import { CONTEXT } from './tokens'; |
@@ -112,10 +112,9 @@ export function createContextBuilder({ |
112 | 112 | }); |
113 | 113 |
|
114 | 114 | // Create a context for application-level ExecutionContext |
115 | | - appContext = { |
116 | | - ...context, |
| 115 | + appContext = merge(context, { |
117 | 116 | injector: operationAppInjector, |
118 | | - }; |
| 117 | + }); |
119 | 118 |
|
120 | 119 | // Track Providers with OnDestroy hooks |
121 | 120 | registerProvidersToDestroy(operationAppInjector); |
@@ -151,23 +150,24 @@ export function createContextBuilder({ |
151 | 150 | // Same as on application level, we need to collect providers with OnDestroy hooks |
152 | 151 | registerProvidersToDestroy(operationModuleInjector); |
153 | 152 |
|
154 | | - contextCache[moduleId] = { |
155 | | - ...ctx, |
| 153 | + contextCache[moduleId] = merge(ctx, { |
156 | 154 | injector: operationModuleInjector, |
157 | 155 | moduleId, |
158 | | - }; |
| 156 | + }); |
159 | 157 | } |
160 | 158 |
|
161 | 159 | return contextCache[moduleId]; |
162 | 160 | } |
163 | 161 |
|
164 | | - const sharedContext = { |
| 162 | + const sharedContext = merge( |
165 | 163 | // We want to pass the received context |
166 | | - ...(context || {}), |
167 | | - // Here's something very crutial |
168 | | - // It's a function that is used in module's context creation |
169 | | - ɵgetModuleContext: getModuleContext, |
170 | | - }; |
| 164 | + context || {}, |
| 165 | + { |
| 166 | + // Here's something very crutial |
| 167 | + // It's a function that is used in module's context creation |
| 168 | + ɵgetModuleContext: getModuleContext, |
| 169 | + } |
| 170 | + ); |
171 | 171 |
|
172 | 172 | attachGlobalProvidersMap({ |
173 | 173 | injector: operationAppInjector, |
|
0 commit comments