-
Notifications
You must be signed in to change notification settings - Fork 26k
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
feat(core): allow for injector to be specified when creating an embedded view #45156
Conversation
* @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional` | ||
* @returns the value from the injector, `null` when not found, or `notFoundValue` if provided | ||
*/ | ||
function lookupTokenUsingNodeInjector<T>( |
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.
This function's code is the same as getOrCreateInjectable
currently, feel free to ignore when reviewing.
|
||
const noInjectorHarness = setupTestHarness(template, 1, 0, 1, {}, null, [noInjectorApp.ɵcmp]); | ||
const withInjectorHarness = setupTestHarness(template, 1, 0, 1, {}, null, [withInjectorApp.ɵcmp]); | ||
|
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.
There's something weird going on in this benchmark, because whichever case runs first ends up being quicker, even if it I give it identical components by not passing in an injector above. The difference can be observed by swapping the order of the while
loops below.
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.
That's super interesting. One hypothesis is that it could be a branch misprediction issue, where we train the branch predictor to expect one case (no embedded injector) and then violate that assumption in the next case (embedded injector present).
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.
It's worth noting that the same happens if I create two identical components that don't hit the new code path.
6c25558
to
e000854
Compare
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.
reviewed-for: fw-core, fw-common, public-api
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 🍪
reviewed-for: public-api, fw-core, fw-common, size-tracking
b4a4ee1
to
f179023
Compare
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.
Reviewed-for: public-api
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.
reviewed-for: public-api, fw-core, fw-common, size-tracking
f179023
to
7f83ce0
Compare
This PR was merged into the repository by commit 94c949a. |
We are going to roll this back, we think it caused a failure in sync cl/431510120. |
…an embedded view (angular#45156)" This reverts commit 94c949a.
…an embedded view (angular#45156)" This reverts commit 94c949a.
a8cac4d
to
29e2c76
Compare
…ded view Adds support for passing in an optional injector when creating an embedded view through `ViewContainerRef.createEmbeddedView` and `TemplateRef.createEmbeddedView`. The injector allows for the DI behavior to be customized within the specific template. This is a second stab at the changes in angular#44666. The difference this time is that the new injector acts as a node injector, rather than a module injector. Fixes angular#14935.
29e2c76
to
2db9321
Compare
Passing TGP after a fix yesterday where one of the bitmaps was missing a bit. Unblocking. |
This PR was merged into the repository by commit 69018c9. |
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. |
…ded view (angular#45156) Adds support for passing in an optional injector when creating an embedded view through `ViewContainerRef.createEmbeddedView` and `TemplateRef.createEmbeddedView`. The injector allows for the DI behavior to be customized within the specific template. This is a second stab at the changes in angular#44666. The difference this time is that the new injector acts as a node injector, rather than a module injector. Fixes angular#14935. PR Close angular#45156
…ded view (angular#45156) Adds support for passing in an optional injector when creating an embedded view through `ViewContainerRef.createEmbeddedView` and `TemplateRef.createEmbeddedView`. The injector allows for the DI behavior to be customized within the specific template. This is a second stab at the changes in angular#44666. The difference this time is that the new injector acts as a node injector, rather than a module injector. Fixes angular#14935. PR Close angular#45156
Adds support for passing in an optional injector when creating an embedded view through
ViewContainerRef.createEmbeddedView
andTemplateRef.createEmbeddedView
. The injector allows for the DI behavior to be customized within the specific template.This is a second stab at the changes in #44666. The difference this time is that the new injector acts as a node injector, rather than a module injector.
Fixes #14935.