Skip to content

[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) #17180

@MarkPieszak

Description

@MarkPieszak

I'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)

cc/ @alxhub @vikerman @gdi2290

Metadata

Metadata

Assignees

Labels

area: serverIssues related to server-side renderingarea: zonesIssues related to zone.js

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions