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
constmodel=newBackbone.Model();constcollection=newBackbone.Collection.extend({model: model});collection.add({id: 1,foo: false});// do some other stuffcollection.add({id: 1,foo: true});// Final result: [{ id: 1, foo: true }]
It will only add a model to the collection once and override its values. Currently mobx-binder will not do that, it would just add the same model twice.
I'm not sure yet if we should build this into mobx-binder. It can be very nice, but it can also be weird black magic.
Maybe specifically for .add() it make sense, but for .fetch() I'd rather do a full reset of the store each time. In most of our Backbone apps we now do collection.fetch({ reset: true }) nearly everywhere, so we could make that the default here.
In Backbone, when you do this:
It will only add a model to the collection once and override its values. Currently mobx-binder will not do that, it would just add the same model twice.
I'm not sure yet if we should build this into mobx-binder. It can be very nice, but it can also be weird black magic.
Maybe specifically for
.add()
it make sense, but for.fetch()
I'd rather do a full reset of the store each time. In most of our Backbone apps we now docollection.fetch({ reset: true })
nearly everywhere, so we could make that the default here.Needs discussion with @jasperstam and @abzainuddin.
The text was updated successfully, but these errors were encountered: