You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an element defines an array property foo and want to keep the array sorted, one might write code like this:
fooChanged: function() {
this.foo.sort();
}
However, if the sort mutates the order of the array, the fooChanged method will be called again. This is because polymer reports array mutations as changes. This is appropriate for this use case. One probably wants to sort the array if it's new or if it mutates.
To fix this, we might consider adding a way to squelch changes.
The text was updated successfully, but these errors were encountered:
This seems like an antipattern to me. If you mutate the data that you are observing in the callback which is called when it changes, you are going to have a bad time.
If an element defines an array property foo and want to keep the array sorted, one might write code like this:
However, if the sort mutates the order of the array, the fooChanged method will be called again. This is because polymer reports array mutations as changes. This is appropriate for this use case. One probably wants to sort the array if it's new or if it mutates.
To fix this, we might consider adding a way to squelch changes.
The text was updated successfully, but these errors were encountered: