[platform-server] console.log in certain lifecycle hooks could cause an infinite loop since it results in a microtask on Node.JS (was: ngAfterViewChecked causes infinite loop)
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report
Current behavior
Adding ngAfterViewChecked() { }
(even if blank) to any Component causes infinite loop and server-render timesout.
Expected behavior Let the zone stabilize and render the application.
Minimal reproduction of the problem with instructions This branch here: https://github.com/MarkPieszak/ng-universal-demo/tree/ngAfterViewChecked-bug
You can see the only addition was: https://github.com/MarkPieszak/ng-universal-demo/blob/ngAfterViewChecked-bug/src/app/app.component.ts#L24-L26
What is the motivation / use case for changing the behavior? Lifecycle hooks fix.
Please tell us about your environment: This happens in Node/express and also ASP.NET Core/Node
-
Angular version: 4.x
-
Node (for AoT issues):
node --version
= Any version (tested on 6.x, 7.x, 8.0)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13 (10 by maintainers)
I’ve been slamming my head in against a wall for 3 whole days before finding that the issue is due to the console.log statement. @gdi2290 where do I alter the isStable logic?
This is a Zone issue (rather than change detection one) because any task that would call
console.log
from a begin/end zone hook would also cause this infinite loop.