backbone-nested icon indicating copy to clipboard operation
backbone-nested copied to clipboard

Setting data inside an array fires an add event on the parent array

Open uplift opened this issue 12 years ago • 1 comments

I put together this jsfiddle to show what I mean.

http://jsfiddle.net/uz6VF/1/

I'd expect to only see one 'added' displayed but seeing three. I've narrowed it down to this line

https://github.com/afeld/backbone-nested/blob/master/backbone-nested.js#L262

but cant see an obvious fix. Any ideas?

uplift avatar Sep 23 '12 10:09 uplift

Hmm, yep, add() is using set() under the hood, but should probably be checking isNewValue (or something) before firing that event. Looking into it now.

afeld avatar Sep 23 '12 21:09 afeld