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 was expecting that once the server return the same Snippet object, a new object wouldn't be created, but the result is that a new object is added to the Backbone.Relational.store collections.
I saw that I can "solve" the problem using something like this:
var snippet = Snippet.findOrCreate(model.id) || new Snippet();
snippet._path = 'show/' + model.id;
snippet.fetch({
success: function(model, response) {
...
}
});
but I thought it would be nice to report this.
The text was updated successfully, but these errors were encountered:
Hi all,
I'm able to instantiate more than one object of the same type with the same ID. I attach the screenshot:
This happens when I fetch a collection of "Snippets" and after that I fetch one of the objects using a new Snippet object.
To give more context, the API I'm using looks like Twitter API, and API calls look like:
List collection of Snippets: /snippets/created/by/:user_id
Detail of snippet: /snippets/show/:snippet_id
So, to get the information of a Snippet:
I was expecting that once the server return the same Snippet object, a new object wouldn't be created, but the result is that a new object is added to the Backbone.Relational.store collections.
I saw that I can "solve" the problem using something like this:
but I thought it would be nice to report this.
The text was updated successfully, but these errors were encountered: