gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
615 stars 89 forks source link

initComputeds ignores model.parse #127

Closed DenMesh closed 8 years ago

DenMesh commented 8 years ago

In the constructor for the Epoxy model, initComputeds is called with the same attributes argument, as the one passed into the construction function. However, this does not take into account the fact that the call to constructor before it may modify the attributes using "parse". Thus, if attributes include a property with the same key as a computed, an error arises, even if the key is being removed during parse.

A straightforward but NOT extensively tested solution is to replace line 74 from this.initComputeds(attributes, options); to this.initComputeds(this.attributes, options);

Again, a warning: I do not know if it may or may not break any other part of Epoxy.

gmac commented 8 years ago

You got it. Thanks!

https://github.com/gmac/backbone.epoxy/blob/d266cadc698103924652c9dd171e229ff6395ffe/backbone.epoxy.js#L74