Skip to content

fix(Changedetection): ngAfterViewChecked is called when component is set to OnPush and no input properties changed #7055

@0x-r4bbit

Description

@0x-r4bbit

Similar to #7054 it seems that ngAfterViewChecked() is called, when a component is set to OnPush and no input property changed, or event is fired inside that component.

Here's a plunk that demonstrates the issue: http://plnkr.co/edit/3HEH7AcrQaVUF0PTQBNv?p=preview

You'll see two components. One gets bootstrapped and the second one is set to OnPush, so it should only run change detection when either one of its input properties changes, or an event is fired inside that component.

Expectation: OnPush Child Component should not turn green when the button is clicked, as no input properties are changing and no event is fired from inside the child component.

UPDATE: Similar to #7054 ngAfterViewCheck() is called, but change detection is not performed as we can see in this plunk: http://plnkr.co/edit/picW7fedYGY2PIPxp0Ur?p=preview

The subtree of OnPush component is not checked when we trigger CD.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: change detectionfeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under consideration

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions