Skip to content

New change detection strategy onPushStrict #14628

@MickL

Description

@MickL

I'm submitting a ...

[ ] bug report
[X] feature request
[ ] support request

Current behavior
We only have two change detection strategies: Default and OnPush

  • OnPush doesn't trigger change detection if no input changed
  • If something changed inside of this component change detection runs for whole application
  • To prevent this we have to set OnPush for EVERY other component

current

Expected behavior
New strategy 'onPushStrict' (working title) OR default behavior if component has not output's:

  • Don't trigger change detection if no input changed (same as OnPush)
  • Trigger change detection only for this component and its child's
  • Changes will not affect parent(s) at all

expected

What is the motivation / use case for changing the behavior?
Lets say we have a component which is a "closed system": It gets input and any changes inside of the component will ONLY affect this component.

For example a component which has no input at all. It gets an image of a webcam from the server and displays it. There would be no need to run change detection for the whole application.

Lets make this example more problematic: The component subscribes to document event "mousemove" and does something with the event. EVERY mousemove (alot per second!) will then trigger change detection for the whole app if none of the outside components use OnPush.

Angular version:
2.4.X or 4.x.x

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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions