rivets
rivets copied to clipboard
Computed properties don't seem to resubscribe when the model is updated
I had an issue where certain parts of my view stopped reacting to model updates because the computed bindings they depended on didn't unsubscribe from old models and resubscribe to new ones when the model structure updated. in the same way other bindings did.
I resolved the issue by modifying the Binding.update function. I will provide my changes in a pull request in case they are useful.
I believe I'm facing the same problem. Here's a fiddle: http://jsfiddle.net/ZRHdA/3/ (rivets.js is loaded from the HEAD of master at rawgithub.com)
@mikeric any chance this issue will be addressed in the near future?
I confirm the bug is still present. I updated the fiddle with the most recent build: http://jsfiddle.net/ZRHdA/4/
I think this bug would not appear if we replace computed properties by functions calling like i described in #571 :wink:
Here is a jsfiddle of what I have in mind http://jsfiddle.net/jccazeaux/b64cw9qy/ Code for this feature is on this branch
This is definitely an issue.
I spent some time debugging and was only ever able to reproduce when putting computed on the prototype. This makes me think it could be related to: https://github.com/mikeric/rivets/issues/572
There are allot of weird github issues I can cite with no resolution around how rivets handles methods and properties on prototypes. Will subsequently update this post and cite them if I have a moment tomorrow.
@jccazeaux That call formatter is cool. Would definitely be useful feature.
The work that @stephenhand did some years back seems to be a big change for a small issue.
There is some interesting discussion here around such things: https://github.com/mikeric/rivets/pull/417
I wonder what the implications of modifying this line in sightglass as https://github.com/mikeric/sightglass/blob/master/index.js#L128 as @jccazeaux has pointed out.