-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New change detection strategy onPushStrict #14628
Description
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
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
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

