fix(angular): Set unknown
component name default in TraceDirective
#6222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in the Angular SDK's
TraceDirective
where previously, the fallbackUNKNOWN_COMPONENT
name wasn't correctly applied to the span description if users didn't specify a manual value for the directive:Stumbled across this while testing v15 standalone components so... ref #6219
The reason for this bug is that Angular apparently doesn't entirely respect default values for inputs of directives that have the same name as the directive (but we def want this).
Note: We do actually have a test for this and according to that test, everything worked fine before. This, however, was a problem with the test setup because creating a new instance of
TraceDirective
(which is what the test does) is different behaviour to specifyingtrace
without a name in the component template. With this change now, also this test now fails, if the fallback would not be set correctly so I don't think we strictly need another test here.Note2: There is another way how to set default values for inputs with the same name as the directive selector. However, I don't consider this particularly cleaner so I opted for this way instead which should also have less bundle size impact than the way above.