Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
fix(upgrade): several ngUpgradeLite fixes #27217
What is the current behavior?
See commit messages for more details.
What is the new behavior?
Does this PR introduce a breaking change?
Nov 22, 2018
referenced this pull request
Nov 23, 2018
I don't think there is a definition of accurate. We get to decide it for ourselves
The main controversy is that, once the element injector tree has been traversed and we get to the component's module, no other modules are checked. This is different than what happens with lazy-loaded modules (which is the only other case I know of, where multiple moduleRef's have their own injector).
The difference here (if my understanding is correct), is that moduleRefs can have other moduleRefs as parents. The router sets the lazy loaded modules to have the main app module as parent, thus the main injector is checked when something cannot be found on the lazy-loaded module's injector. But with
As a workaround, one has to ensure that any shared dependencies must be on the platform injector (which is an ancestor of all module injectors).
One usecase that might catch people off-guard, is when you have one main downgraded module and several smaller (possibly lazy-loaded) downgraded modules. And you expect components in those smaller modules to be able to access providers from the "main" module.
Maybe we could make so that the downgraded module that is instantiated first is considered the "main" module and all other downgraded modules are considered its children (so they all have access to its providers).
I think this is a good backup plan, but is it worth implementing now? Perhaps we should ask someone like @mhevery ?
I am not fully following the discussion. But here is how I think the injection should work.