Netflix / x-element

A dead simple starting point for custom elements.
Apache License 2.0
28 stars 12 forks source link

Don’t observe unchanged, computed properties. #43

Closed theengineear closed 5 years ago

theengineear commented 5 years ago

@klebba , this basically fixes an issue where you could observe a noop in a computed property. Consider the computed property:

computeC(a, b) {
  if (a && b) {
    return a + b;
  }
}

If a is falsey, changing b will have no effect on c. It was basically cases like these causing observers to be called when nothing has changed.

Note that I've got some tests for this, but I wrote them with the new test runner that we created, so you'll have to trust that I'll include that test when I get that testing PR merged.

theengineear commented 5 years ago

@klebba as discussed, going to merge this since it fixes an issue. as a bonus, now that the testing code was merged in, i updated our test suite to cover this case.

klebba commented 5 years ago

Great!