-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor: don't depend on @Inject for _MatMenuBase DI #15975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In Ivy, undecorated base classes (like _MatMenuBase) don't have the same behavior as View Engine; specifically, inheriting the constructor from the base class will not work in the DI system. Even in View Engine this was often counter-intuitive - only constructors with DI decorators would be properly inherited in JIT. This commit updates _MatMenuBase to not rely on this implementation detail of Angular, and instead moves the injected constructor onto _MatMenu itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
With Ivy, directives or components no longer properly inherit a constructor from a parent base class which is undecorated. See more details here: FW-1238 In order to avoid dependency injection issues with Ivy, a new custom TSLint rule reports a failure when a directive/component uses dependency injection in a way that breaks with Ivy. Related to angular#15975
With Ivy, directives or components no longer properly inherit a constructor from a parent base class which is undecorated. See more details here: FW-1238 In order to avoid dependency injection issues with Ivy, a new custom TSLint rule reports a failure when a directive/component uses dependency injection in a way that breaks with Ivy. Related to angular#15975
The MDC based impl needs the same fix, as I'm a hitting a failure after rebasing ivy-2019. I'm putting the fix in in the ivy-2019 branch manually now, if it's possible to also get the change in here that would be awesome :) |
With Ivy, directives or components no longer properly inherit a constructor from a parent base class which is undecorated. See more details here: FW-1238 In order to avoid dependency injection issues with Ivy, a new custom TSLint rule reports a failure when a directive/component uses dependency injection in a way that breaks with Ivy. Related to #15975
In Ivy, undecorated base classes (like _MatMenuBase) don't have the same behavior as View Engine; specifically, inheriting the constructor from the base class will not work in the DI system. Even in View Engine this was often counter-intuitive - only constructors with DI decorators would be properly inherited in JIT. This commit updates _MatMenuBase to not rely on this implementation detail of Angular, and instead moves the injected constructor onto _MatMenu itself.
With Ivy, directives or components no longer properly inherit a constructor from a parent base class which is undecorated. See more details here: FW-1238 In order to avoid dependency injection issues with Ivy, a new custom TSLint rule reports a failure when a directive/component uses dependency injection in a way that breaks with Ivy. Related to angular#15975
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. |
In Ivy, undecorated base classes (like _MatMenuBase) don't have the same
behavior as View Engine; specifically, inheriting the constructor from the
base class will not work in the DI system. Even in View Engine this was
often counter-intuitive - only constructors with DI decorators would be
properly inherited in JIT.
This commit updates _MatMenuBase to not rely on this implementation detail
of Angular, and instead moves the injected constructor onto _MatMenu itself.
Fixes #15937