-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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): add source to StaticInjectorError
message
#20817
Conversation
You can preview 2b12e7f at https://pr20817-2b12e7f.ngbuilds.io/. |
Was rolled back in g3. Determine cause before merging. |
@@ -25,7 +25,7 @@ export function moduleProvideDef( | |||
// lowered the expression and then stopped evaluating it, | |||
// i.e. also didn't unwrap it. | |||
value = resolveForwardRef(value); | |||
const depDefs = splitDepsDsl(deps); |
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.
The issue is that token
can be null
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.
You should use stringify
from core/src/util
here as stringify(token)
packages/core/src/view/provider.ts
Outdated
@@ -83,7 +83,7 @@ export function _def( | |||
// i.e. also didn't unwrap it. | |||
value = resolveForwardRef(value); | |||
|
|||
const depDefs = splitDepsDsl(deps); | |||
const depDefs = splitDepsDsl(deps, token.name); |
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.
maybe same problem here?
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.
stringify(token)
2b12e7f
to
032789a
Compare
You can preview 032789a at https://pr20817-032789a.ngbuilds.io/. |
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. |
PR Type
What kind of change does this PR introduce?
What is the current behavior?
We need more info on
StaticInjectorError
to help with debuggingIssue Number: #19302, also Fixes #20172
What is the new behavior?
We add the source component (or module) that tried to inject the missing provider, and we also add the source from the injector which triggered the error
Notes:
__source
, we could use a different property name (I wasn't inspired), but I'm not sure if it's ok to add a property name like that.Does this PR introduce a breaking change?
Other information
I already did a PR with that change but we had to revert because of issues in g3, but I don't know what were the issues, and I haven't changed the code since then.