fix(core): ensure that standalone components get correct injector instances#50954
fix(core): ensure that standalone components get correct injector instances#50954AndrewKushnir wants to merge 1 commit intoangular:mainfrom
Conversation
…tances Prior to this change, we've used `componentDef.id` as a key in a Map that acts as a cache to avoid re-creating injector instances for standalone components. In v16, the logic that generates the id has changed from an auto-incremental to a generation based on metadata. If multiple components have similar metadata, their ids might overlap. This commit updates the logic to stop using `componentDef.id` as a key and instead, use the `componentDef` itself. This would ensure that we always have a correct instance of an injector associated with a standalone component instance. Resolves angular#50724.
|
We were talking about this during triage yesterday with @pkozlowski-opensource and @JoostK. I initially introduced it with #46093 to try and reduce the chance of memory leaks. I don't mind going back to tracking it via a reference to the definition itself, but the fact that component IDs aren't actually unique may be a problem in the future. |
|
Yep, the fact that component |
|
Caretaker note: TGP is "green", this PR is ready for merge. |
|
This PR was merged into the repository by commit 031b599. |
…tances (#50954) Prior to this change, we've used `componentDef.id` as a key in a Map that acts as a cache to avoid re-creating injector instances for standalone components. In v16, the logic that generates the id has changed from an auto-incremental to a generation based on metadata. If multiple components have similar metadata, their ids might overlap. This commit updates the logic to stop using `componentDef.id` as a key and instead, use the `componentDef` itself. This would ensure that we always have a correct instance of an injector associated with a standalone component instance. Resolves #50724. PR Close #50954
…tances (angular#50954) Prior to this change, we've used `componentDef.id` as a key in a Map that acts as a cache to avoid re-creating injector instances for standalone components. In v16, the logic that generates the id has changed from an auto-incremental to a generation based on metadata. If multiple components have similar metadata, their ids might overlap. This commit updates the logic to stop using `componentDef.id` as a key and instead, use the `componentDef` itself. This would ensure that we always have a correct instance of an injector associated with a standalone component instance. Resolves angular#50724. PR Close angular#50954
|
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. |
…tances (angular#50954) Prior to this change, we've used `componentDef.id` as a key in a Map that acts as a cache to avoid re-creating injector instances for standalone components. In v16, the logic that generates the id has changed from an auto-incremental to a generation based on metadata. If multiple components have similar metadata, their ids might overlap. This commit updates the logic to stop using `componentDef.id` as a key and instead, use the `componentDef` itself. This would ensure that we always have a correct instance of an injector associated with a standalone component instance. Resolves angular#50724. PR Close angular#50954
Prior to this change, we've used
componentDef.idas a key in a Map that acts as a cache to avoid re-creating injector instances for standalone components. In v16, the logic that generates the id has changed from an auto-incremental to a generation based on metadata. If multiple components have similar metadata, their ids might overlap.This commit updates the logic to stop using
componentDef.idas a key and instead, use thecomponentDefitself. This would ensure that we always have a correct instance of an injector associated with a standalone component instance.Resolves #50724.
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?