PaulUithol/Backbone-relational — Issue #79: Use Backbone.Store to have only one instance for every model I have
Author: 4vanger
Created: 2012-02-17 20:48:54+00:00
State: open

I'm trying to understand how can I use Backbone.Store to make it possible to have only one instance of model per id.
For example I have model Item and collections NewItems, RecentItems, AllItems.
Collections may be fetched or not.
I'd like to do new Item({id:123}) and in case any of my relational collections has instance of this item fetched - return same model.
How this can be used in practice:
ListItemsView displays list of items. For displaying each item there is SingleItemView which uses Item model.
User can click "edit" icon where he can change Item model attributes and then return to list.
If desired behavior can be achieved - all views can be completely independent from each other. Any of them can be used separately. But all of them will use same model so changing model on edit screen will force SingleItemView rerender on "change" event