You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a component using the Backbone.React.Component mixin that accepts a collection.
I populate this collection within my component via Backbone's Collection.reset, passing in an array of JavaScript objects with the model data (not models themselves). For example,
this.getCollection().reset([{ id: "552ac27b526179a194170000", name: "One" }, { id: "552ac27b526179a194190000", name: "Two" }]);
var one = this.getCollection().get("552ac27b526179a194170000");
var two = this.getCollection().get("552ac27b526179a194190000");
// I then pass these two models to some child components.
On the first call to Collection.reset, all of the mixin's bindings work perfectly. If I update/save one of the models from the above example within any child component, the mixin will trigger a re-render.
However, I run into an issue when I call Collection.reset again, and pass in a batch of data that has any overlap with the existing collection. Like so:
this.getCollection().reset([{ id: "552ac27b526179a194170000", name: "One" }, { id: "552ac27b526179a194120000", name: "Three" }]);
var one = this.getCollection().get("552ac27b526179a194170000");
var three = this.getCollection().get("552ac27b526179a194120000");
// I then pass these two models to some child components.
Here, the variable three will have its bindings properly established. However, one actually seems to lose its bindings! For example, when I call one.save({ name: "OneModified" }) within a child component, it won't trigger a re-render on my top-most component.
I think this is an issue with the way that reset events are handled, for models that existed both before and after the reset. Thoughts? Thanks so much!
The text was updated successfully, but these errors were encountered:
@DiegoYungh it's but it's kind of in maintenance mode. Meaning, I'll update things for React 0.14 when I catch my breath but I won't be developing any new features in the near future.
I have a component using the Backbone.React.Component mixin that accepts a collection.
I populate this collection within my component via Backbone's
Collection.reset
, passing in an array of JavaScript objects with the model data (not models themselves). For example,On the first call to
Collection.reset
, all of the mixin's bindings work perfectly. If I update/save one of the models from the above example within any child component, the mixin will trigger a re-render.However, I run into an issue when I call
Collection.reset
again, and pass in a batch of data that has any overlap with the existing collection. Like so:Here, the variable
three
will have its bindings properly established. However,one
actually seems to lose its bindings! For example, when I callone.save({ name: "OneModified" })
within a child component, it won't trigger a re-render on my top-most component.I think this is an issue with the way that
reset
events are handled, for models that existed both before and after the reset. Thoughts? Thanks so much!The text was updated successfully, but these errors were encountered: