8000 fix(core): properly handle the case where getSignalGraph is called on a componentless NodeInjector by AleksanderBodurri · Pull Request #60772 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

fix(core): properly handle the case where getSignalGraph is called on a componentless NodeInjector #60772

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AleksanderBodurri
Copy link
Member

Previously this would throw an error on the assertLView when we try to discover the templateLView.

Now this properly returns null for the template consumer and continues discovering other effects on the injector.

@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Apr 7, 2025
@ngbot ngbot bot added this to the Backlog milestone Apr 7, 2025
@AleksanderBodurri AleksanderBodurri force-pushed the fix-get-signal-graph-call-on-non-component-directives branch from e2f18db to b7b93c3 Compare April 14, 2025 14:08
@AleksanderBodurri AleksanderBodurri marked this pull request as ready for review April 14, 2025 14:09
@pullapprove pullapprove bot requested a review from atscott April 14, 2025 14:09
@AleksanderBodurri AleksanderBodurri requested review from dgp1130 and removed request for atscott April 14, 2025 14:11
@pullapprove pullapprove bot requested a review from atscott April 14, 2025 14:11
@AleksanderBodurri AleksanderBodurri added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Apr 21, 2025
Copy link
Member
@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AleksanderBodurri I think that this change will need a test - without a test it is not clear under which conditions the assert starts to fail. And there is a risk that we accidentally refactor the code in a way that breaks dev tools again.

@pkozlowski-opensource pkozlowski-opensource added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Apr 22, 2025
@AleksanderBodurri AleksanderBodurri force-pushed the fix-get-signal-graph-call-on-non-component-directives branch 2 times, most recently from fa7bbf3 to 94d9e44 Compare May 5, 2025 06:25
@AleksanderBodurri AleksanderBodurri force-pushed the fix-get-signal-graph-call-on-non-component-directives branch from 94d9e44 to 2a30cac Compare May 5, 2025 06:28
@AleksanderBodurri
Copy link
Member Author

@AleksanderBodurri I think that this change will need a test - without a test it is not clear under which conditions the assert starts to fail. And there is a risk that we accidentally refactor the code in a way that breaks dev tools again.

Good point 🙏 Added another test case for getSignalGraph that goes through the component-less NodeInjector case

@AleksanderBodurri AleksanderBodurri added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels May 5, 2025
@AleksanderBodurri AleksanderBodurri force-pushed the fix-get-signal-graph-call-on-non-component-directives branch from 2a30cac to 7b264ec Compare May 5, 2025 14:11
Comment on lines 317 to 318
it('should return no nodes or edges for a NodeInjector that only has directives and no component', fakeAsync(() => {
@Directive({
Copy link
Member
@JeanMeche JeanMeche May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I acknoledge there are existing tests with the same pattern but I think we can simplify the test.

  • dropping the fakeAsync
  • remove the tick that doesn't do much I believe
  • remove compileComponents() which isn't required here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouu nice, did this change recently? I could swear in the past these tests would fail without the tick.

Made the change. Will open a follow up PR for the other test cases in this file so as to not pollute this PR

… a componentless NodeInjector

Previously this would throw an error on the assertLView when we try to discover the templateLView.

Now this properly returns null for the template consumer and continues discovering other effects on the injector.
@AleksanderBodurri AleksanderBodurri force-pushed the fix-get-signal-graph-call-on-non-component-directives branch from 7b264ec to 3683156 Compare May 5, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0