Skip to content
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

Angular 17.3 ngOnInit running infinite loop with defer block #55036

Closed
dreamstar-enterprises opened this issue Mar 25, 2024 · 13 comments
Closed
Assignees
Labels
area: core Issues related to the framework runtime core: defer Issues related to @defer blocks. P2 The issue is important to a large percentage of users, with a workaround
Milestone

Comments

@dreamstar-enterprises
Copy link

dreamstar-enterprises commented Mar 25, 2024

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

Yes

Description

Full documentation of issue here >>
https://stackoverflow.com/questions/78216445/angular-ngoninit-running-multipe-times-resulting-in-call-stack-error-with-sign

Wasn't a problem with Angular 17.01...

Please provide a link to a minimal reproduction of the bug

https://stackoverflow.com/questions/78216445/angular-ngoninit-running-multipe-times-resulting-in-call-stack-error-with-sign

Please provide the exception or error you saw

See here >> 
https://stackoverflow.com/questions/78216445/angular-ngoninit-running-multipe-times-resulting-in-call-stack-error-with-sign

Wasn't a problem with Angular 17.01

Please provide the environment you discovered this bug in (run ng version)

No response

Anything else?

No response

@alxhub alxhub added the needs reproduction This issue needs a reproduction in order for the team to investigate further label Mar 25, 2024
@atscott
Copy link
Contributor

atscott commented Mar 25, 2024

Please provide a runnable reproduction, either in a Github repository or Stackblitz.

@dreamstar-enterprises
Copy link
Author

Done! Not sure if you can see the code and replicate the issue..
UPDATE STACKBLITZ

Here is what I managed to put onto Stackblitz
https://stackblitz.com/edit/stackblitz-starters-aeguwd?file=src%2Fproject-parent%2Fproject-parent.routes.ts

@atscott
Copy link
Contributor

atscott commented Mar 26, 2024

@dreamstar-enterprises Thank you for the reproduction. @AndrewKushnir I simplified the reproduction quite a bit here: https://stackblitz.com/edit/stackblitz-starters-bmouvm. This seems pretty similar to #54864 where a component with imports causes an issue.

@atscott atscott added core: defer Issues related to @defer blocks. P2 The issue is important to a large percentage of users, with a workaround and removed needs reproduction This issue needs a reproduction in order for the team to investigate further labels Mar 26, 2024
@dreamstar-enterprises
Copy link
Author

dreamstar-enterprises commented Mar 26, 2024

Thanks. I don't know what's causing it, but it just refuses to load both components in the defer block. project navigation gets repeatedly loaded, and router outlet, won't load project-detail (which is an empty component anyway). But I can load each component, when I comment one or the other out. The links also lose all their relative link referencing....

Screenshot 2024-03-26 at 18 09 52 Screenshot 2024-03-26 at 18 10 12 Screenshot 2024-03-26 at 18 11 25

@dreamstar-enterprises
Copy link
Author

Screenshot 2024-03-26 at 18 14 18

@AndrewKushnir AndrewKushnir self-assigned this Mar 26, 2024
@AndrewKushnir AndrewKushnir added the area: core Issues related to the framework runtime label Mar 26, 2024
@ngbot ngbot bot added this to the Backlog milestone Mar 26, 2024
@dreamstar-enterprises
Copy link
Author

dreamstar-enterprises commented Mar 26, 2024

For more information, this does work! (But, i have other components, where I do need multiple components in a defer block, so, not sure what's going on with Angular 17.3). If put the components in nested defer blocks, inside the main defer block it also, strangely, works, but the components lose their relative link referencing, and reference from the app root...

Screenshot 2024-03-26 at 18 47 47 Screenshot 2024-03-26 at 18 52 50

@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented Mar 27, 2024

@dreamstar-enterprises I've confirmed that the root cause of this issue is the same as the one in #54864. We are working on a fix and I'll share an update once the fix is available.

@dreamstar-enterprises
Copy link
Author

Thank you! I really, really appreciate it. (I'll try to roll back to 17.01 if I can in the meantime)

AndrewKushnir added a commit to AndrewKushnir/angular that referenced this issue Mar 28, 2024
…ocks

This commit updates the `@defer` logic to establish proper injector resolution order. More specifically:

- Makes node injectors to be inspected first, similar to how it happens when `@defer` block is not used.
- Adds extra handling for the Router's `OutletInjector`, until we replace it with an `EnvironmentInjector`.

Resolves angular#54864.
Resolves angular#55028.
Resolves angular#55036.
dylhunn pushed a commit that referenced this issue Mar 28, 2024
…ocks (#55079)

This commit updates the `@defer` logic to establish proper injector resolution order. More specifically:

- Makes node injectors to be inspected first, similar to how it happens when `@defer` block is not used.
- Adds extra handling for the Router's `OutletInjector`, until we replace it with an `EnvironmentInjector`.

Resolves #54864.
Resolves #55028.
Resolves #55036.

PR Close #55079
@dreamstar-enterprises
Copy link
Author

Thank you. The issue seems closed now. Do you know how I, myself, could get the changes. Or do I have to wait for the next published release?

@atscott
Copy link
Contributor

atscott commented Mar 28, 2024

Or do I have to wait for the next published release?

There will be a release later today that includes the fix.

@AndrewKushnir
Copy link
Contributor

Quick update: the fix for this issue was merged and released as a part of Angular v17.3.2 (available on NPM). Please let us know if you still see the issue after updating to v17.3.2.

@dreamstar-enterprises
Copy link
Author

Its fixed! Works great! (like it did with 17.0.1). Thank you very much for listening to my request, and investigating / attacking the problem! I'm very grateful!

ilirbeqirii pushed a commit to ilirbeqirii/angular that referenced this issue Apr 6, 2024
…ocks (angular#55079)

This commit updates the `@defer` logic to establish proper injector resolution order. More specifically:

- Makes node injectors to be inspected first, similar to how it happens when `@defer` block is not used.
- Adds extra handling for the Router's `OutletInjector`, until we replace it with an `EnvironmentInjector`.

Resolves angular#54864.
Resolves angular#55028.
Resolves angular#55036.

PR Close angular#55079
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime core: defer Issues related to @defer blocks. P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants