I’m getting some funny behavior using computed properties. I have extracted the relevant parts from the application in this JS bin with some additional debugging:
The general gist is that the isCase and isNotCase do not consistently report their values correctly. So what those two computed properties.
Steps to reproduce:
- Click [values] - you should see, “true false” - this is correct
- Type y101 into the input box
- Click [values] - you should see, “false true” - this is correct
- Click [clear] - you will see “false false” - not correct
- click [values] - you will see “false false” - not correct
Just trying to understand why isCase (dependent on isNotCase) is not updating properly. You can step through it and see that when it recomputes isCase, it asks isNotCase for its value. isNotCase asks isVolume/isWeight for their computed values, however they do not return the correct value. Thus this incorrectly cached on isCase.
Does this have something to do with the observer? Or the fact that I’m using computed properties on top of computed properties? Is this the desired result?