fix(core): stop reusing provider definitions across NgModuleRef instances (#25022)
Fixes #25018. Instantiating a NgModuleRef from NgModuleFactory reuses the NgModuleDefinition if it is already present. However the NgModuleDefinition has a providers array which modified when tree shakable providers are instantiated. This corrupts the provider definitions the next time the same factory is used to create a new NgModuleRef - Two provider definitions can end up with the same index anf the injector could potentially return a completely wrong object for a provider token. This scenario is more likely on the server where the same NgModuleFactory is reused across requests. The fix clones the cached NgModuleDefinition so that any tree shakable providers added later do not affect the cached copy. PR Close #25022
This commit is contained in:

committed by
Victor Berchet

parent
7960d1879d
commit
6b859daea4
@ -2414,6 +2414,9 @@
|
||||
{
|
||||
"name": "checkStable"
|
||||
},
|
||||
{
|
||||
"name": "cloneNgModuleDefinition"
|
||||
},
|
||||
{
|
||||
"name": "collectReferences"
|
||||
},
|
||||
|
Reference in New Issue
Block a user