Skip to content

feature: throw an error in case of afterRender misuse.  #51343

@JeanMeche

Description

@JeanMeche

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: lifecycle hooksfeatureLabel used to distinguish feature request from other issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions