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
fix(core): support InjectFlags
argument in NodeInjector.get()
#41592
Conversation
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.
@vthinkxie thanks for creating this PR. A couple comments:
- This change should also contain a number of tests that would make sure the flags work as expected and are aligned with token injection performed via constructor arguments.
- The
NodeInjector
is a part of the Ivy logic and the ViewEngine version of it doesn't seem to have theflags
support either (see here). We'd need to consider adding the logic there too (for general feature parity).
We'll discuss this with the team more and I will followup here with some additional information.
Thank you.
Hi @vthinkxie, sorry for the delay in answering. We've discussed this feature request with the team and we'd like to move forward with the implementation. A couple notes:
Please let me know if any additional information is required (on adding tests or anything else related to this change). Thank you. |
69448a4
to
cbb39e5
Compare
I have added some tests in |
cbb39e5
to
f76077d
Compare
425d945
to
0abe20f
Compare
Hi @AndrewKushnir |
Hi @vthinkxie, thanks for addressing the feedback. I will have a look at the changes within the next couple days and let you know. One thing that I noticed is that the Thank you. |
Thanks, @AndrewKushnir |
Oh there is a typo in the commit message. Can we update it to:
|
The `InjectFlags` argument was defined for both `getOrCreateInjectable()` and `Injector`, but was ignored in `NodeInjector`. This PR adds support for getting parent token via `NodeInjector.get()`. close angular#31776
1a56fd7
to
69e3747
Compare
InjectFlags
argument in NodeInjector.get()
done |
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.
@vthinkxie thanks for working on this change 👍
Quick update after running tests in Google's codebase: there is a failing target with the changes from this PR. The underlying reason is that the 3rd argument was provided (the flags), but the code used to ignore it and with this change, the correct logic is now invoked. The situation is similar to the one we have in the Components repo (where the |
The linked code from the Components repo should still work. We added the |
Tthe concern was more that Also, I don't understand why this code would fail after this PR but not before? Does passing |
I think that we want to keep the Regarding the optional flag, my understanding was that if it isn't passed, the injector will throw an error if it can't find the token, whereas with the flag it returns the fallback value. |
@crisbeto thanks for the comment. I will proceed with the cleanup in Google's codebase and provide an update once we can proceed with the merge (hopefully within the next couple days). |
Global Presubmit #2 (internal-only link). |
FYI presubmits went well. @petebacondarwin please let us know if you have any additional feedback and if not, we can proceed with the merge. Thank you. |
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.
Let's merge it!
This PR was merged into the repository by commit 65cb2c5. |
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. |
…gular#41592) The `InjectFlags` argument was defined for both `getOrCreateInjectable()` and `Injector`, but was ignored in `NodeInjector`. This PR adds support for getting parent token via `NodeInjector.get()`. close angular#31776 PR Close angular#41592
close #31776
the InectFlags was defined in both getOrCreateInjectable and Injector, but was ignored in NodeInjector
this PR support getting parent token via injector.get in NodeInjector
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information