{"action":"created","issue":{"url":"https://api.github.com/repos/vecnatechnologies/backbone-torso/issues/283","repository_url":"https://api.github.com/repos/vecnatechnologies/backbone-torso","labels_url":"https://api.github.com/repos/vecnatechnologies/backbone-torso/issues/283/labels{/name}","comments_url":"https://api.github.com/repos/vecnatechnologies/backbone-torso/issues/283/comments","events_url":"https://api.github.com/repos/vecnatechnologies/backbone-torso/issues/283/events","html_url":"https://github.com/vecnatechnologies/backbone-torso/issues/283","id":174047015,"number":283,"title":"Perspectives with Unique Models","user":{"login":"SBShane","id":1068766,"avatar_url":"https://avatars.githubusercontent.com/u/1068766?v=3","gravatar_id":"","url":"https://api.github.com/users/SBShane","html_url":"https://github.com/SBShane","followers_url":"https://api.github.com/users/SBShane/followers","following_url":"https://api.github.com/users/SBShane/following{/other_user}","gists_url":"https://api.github.com/users/SBShane/gists{/gist_id}","starred_url":"https://api.github.com/users/SBShane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SBShane/subscriptions","organizations_url":"https://api.github.com/users/SBShane/orgs","repos_url":"https://api.github.com/users/SBShane/repos","events_url":"https://api.github.com/users/SBShane/events{/privacy}","received_events_url":"https://api.github.com/users/SBShane/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-30T15:14:24Z","updated_at":"2016-08-30T16:39:56Z","closed_at":null,"body":"First off I want to say that backbone-torso looks very promising. I came across it while trying to figure out elegant solutions to some of the problems I was having with Backbone. I've started using it for a project even though I know it's not finished yet.\r\n\r\nThat said, this isn't an issue, but more of a question. In the torso generator, I see that all perspectives are returned as essentially singletons. Which is great because if I leave the perspective and them come back to it, everything is still there. But I'm having trouble figuring out the best way to handle a common scenario:\r\nA ListView that links to a DetailView where each DetailView contains a unique model (or just its id) and therefore unique information. Some solutions I see are:\r\n\r\nA.\r\nDetailView doesn't return/export a singleton. This would allow me to initialize the view from Router with the unique model. This is the common approach for Backbone. But this then complicates the switchPerspective method because now I need to check whether the View is already initialized and handle it differently. Additionally, I also have to modify the switchPerspective method further to dispose of this view instead of just detaching it.\r\n\r\nB.\r\nAttach a ChildView to DetailView from Router that contains the unique model. While this works, this seems to not be recommended. Only DetailView should be aware of it's child views.\r\n\r\nC.\r\nAdd a setModel to DetailView. This seems to align with how ListView works with setCollection. After the Router switches perspectives, the Router calls this.current.setModel with the new model. I would have to implement setModel similar to setCollection to stop listening to the previous model.\r\n\r\n\r\nOption C seems to me to be the preferred way to handle this, but wanted to see if you already had an elegant way of handling this scenario or what you would recommend."},"comment":{"url":"https://api.github.com/repos/vecnatechnologies/backbone-torso/issues/comments/243501206","html_url":"https://github.com/vecnatechnologies/backbone-torso/issues/283#issuecomment-243501206","issue_url":"https://api.github.com/repos/vecnatechnologies/backbone-torso/issues/283","id":243501206,"user":{"login":"kentmw","id":426396,"avatar_url":"https://avatars.githubusercontent.com/u/426396?v=3","gravatar_id":"","url":"https://api.github.com/users/kentmw","html_url":"https://github.com/kentmw","followers_url":"https://api.github.com/users/kentmw/followers","following_url":"https://api.github.com/users/kentmw/following{/other_user}","gists_url":"https://api.github.com/users/kentmw/gists{/gist_id}","starred_url":"https://api.github.com/users/kentmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentmw/subscriptions","organizations_url":"https://api.github.com/users/kentmw/orgs","repos_url":"https://api.github.com/users/kentmw/repos","events_url":"https://api.github.com/users/kentmw/events{/privacy}","received_events_url":"https://api.github.com/users/kentmw/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T16:39:56Z","updated_at":"2016-08-30T16:39:56Z","body":"I'm still trying to hone in on what the relationship between DetailView and ListView is. A ListView is usually backed by a Collection of Models or Cells (if the model isn't persisted). ItemViews are generated as soon as the collection adds/reorders/removes a model/cell. Is your DetailView acting as the ItemView? If it is, the DetailView will be seeded with the model/cell as `this.model`"}}
{"actor":{"display_login":"kentmw"}}