fix(core): establish proper defer injector hierarchy for components attached to ApplicationRef#56763
fix(core): establish proper defer injector hierarchy for components attached to ApplicationRef#56763AndrewKushnir wants to merge 1 commit intoangular:mainfrom
Conversation
…ttached to ApplicationRef This commit updates the logic that create an injector for defer blocks (when it's needed) to account for a situation when a component is instantiated without a connection to the current component tree. This can happen if a component is created using its factory function or via `createComponent()` call. Resolves angular#56372.
0e2b8e5 to
2e0961b
Compare
| // 1. Provided `parentInjector` | ||
| // 2. Newly-created `EnvironmentInjector` with extra providers | ||
| // 3. `EnvironmentInjector` from the `parentInjector` | ||
| if (parentEnvInjector !== parentInjector) { |
There was a problem hiding this comment.
This logic looks reasonable, but I wonder if it's necessary - are there cases where parentInjector is not directly an EnvironmentInjector? I suspect this is more possible in tests than production applications.
There was a problem hiding this comment.
I agree, this is probably very uncommon. As a potential followup we can explore whether we can change the type of lView[INJECTOR] from an Injector (which is also optional) to ChainedInjector|EnvironmentInjector, in which case we can drop this condition as well.
There was a problem hiding this comment.
Ideally, we'd have a devmodeassert for the cast that passes TGP...
|
Caretaker note: TGP is "green", this PR is ready for merge. |
…ttached to ApplicationRef (#56763) This commit updates the logic that create an injector for defer blocks (when it's needed) to account for a situation when a component is instantiated without a connection to the current component tree. This can happen if a component is created using its factory function or via `createComponent()` call. Resolves #56372. PR Close #56763
…ttached to ApplicationRef (#56763) This commit updates the logic that create an injector for defer blocks (when it's needed) to account for a situation when a component is instantiated without a connection to the current component tree. This can happen if a component is created using its factory function or via `createComponent()` call. Resolves #56372. PR Close #56763
|
This PR was merged into the repository by commit 00d9cd2. The changes were merged into the following branches: main, 18.0.x, 18.1.x |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This commit updates the logic that create an injector for defer blocks (when it's needed) to account for a situation when a component is instantiated without a connection to the current component tree. This can happen if a component is created using its factory function or via
createComponent()call.Resolves #56372.
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?