-
Notifications
You must be signed in to change notification settings - Fork 27.1k
feature: throw an error in case of afterRender misuse. #51343
Copy link
Copy link
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: lifecycle hooksfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
Milestone
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
It'd be great if we could throw an error if a patched API is called within an afterRender() callback
For example :
afterRender(() => setTimeout(() => { ...}, 1000); will run into an infinte render loop
Currently, NG102 is only thrown when a new CD cycle is fired from the context of an afterRender (for example afterRender(() => cd.detectChanges())
Proposed solution
Throw an error to prevent an infinite loop.
Alternatives considered
¯\(ツ)/¯ let the dev close his browser tab and hope (s)he learns from his own mistake.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: lifecycle hooksfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues