Angular: AbstractControl.statusChanges seems to fire needlessly

Created on 9 Aug 2016  ·  1Comment  ·  Source: angular/angular

I'm submitting a ...

[x] bug report

Current behavior

Because the Observer is named with a "changes" moniker I feel like AbstractControl.statusChanges should only emit values whenever the status has actually changed. Instead it seems to run whenever valueChanges runs except with _status_ as a value for the callback.

Expected/desired behavior

It should only fire when the status has changed.

Reproduction of the problem
http://plnkr.co/edit/UTPrVls36cTQjPpwYN2Q

What is the motivation / use case for changing the behavior?
I found it by profiling an extra slow area of our application which caused some UI lag, so my chief complaint would be performance.

It is however terribly easy to add a distinctUntilChanged operator to the subscriber to fix the issue, but the expectation is that you wouldn't need to so its easy to miss without testing.

Please tell us about your environment:

  • Angular version: 2.0.0-rc.4
  • Browser: all
  • Language: all
forms feature medium obvious

Most helpful comment

Currently statusChanges emits every time the status is calculated, not necessarily when it changes. I can see how this might be misleading. However, changing its behavior would be a pretty big breaking change for all forms users. We could possibly add a new event emitter to distinguish between the two. I'd like to get a sense of who would use this for establishing priority. More people feeling the pain of this? Use cases?

>All comments

Currently statusChanges emits every time the status is calculated, not necessarily when it changes. I can see how this might be misleading. However, changing its behavior would be a pretty big breaking change for all forms users. We could possibly add a new event emitter to distinguish between the two. I'd like to get a sense of who would use this for establishing priority. More people feeling the pain of this? Use cases?

Was this page helpful?
0 / 5 - 0 ratings