{"action":"created","issue":{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3124","repository_url":"https://api.github.com/repos/marionettejs/backbone.marionette","labels_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3124/labels{/name}","comments_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3124/comments","events_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3124/events","html_url":"https://github.com/marionettejs/backbone.marionette/issues/3124","id":171200727,"number":3124,"title":"Feature: Persistent regions that survive a containing view's re-render","user":{"login":"rbu","id":65913,"avatar_url":"https://avatars.githubusercontent.com/u/65913?v=3","gravatar_id":"","url":"https://api.github.com/users/rbu","html_url":"https://github.com/rbu","followers_url":"https://api.github.com/users/rbu/followers","following_url":"https://api.github.com/users/rbu/following{/other_user}","gists_url":"https://api.github.com/users/rbu/gists{/gist_id}","starred_url":"https://api.github.com/users/rbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbu/subscriptions","organizations_url":"https://api.github.com/users/rbu/orgs","repos_url":"https://api.github.com/users/rbu/repos","events_url":"https://api.github.com/users/rbu/events{/privacy}","received_events_url":"https://api.github.com/users/rbu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/labels/enhancement","name":"enhancement","color":"bfd4f2"},{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/labels/next","name":"next","color":"009800"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/milestones/26","html_url":"https://github.com/marionettejs/backbone.marionette/milestones/v3.x","labels_url":"https://api.github.com/repos/marionettejs/backbone.marionette/milestones/26/labels","id":817886,"number":26,"title":"v3.x","description":null,"creator":{"login":"jmeas","id":2322305,"avatar_url":"https://avatars.githubusercontent.com/u/2322305?v=3","gravatar_id":"","url":"https://api.github.com/users/jmeas","html_url":"https://github.com/jmeas","followers_url":"https://api.github.com/users/jmeas/followers","following_url":"https://api.github.com/users/jmeas/following{/other_user}","gists_url":"https://api.github.com/users/jmeas/gists{/gist_id}","starred_url":"https://api.github.com/users/jmeas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmeas/subscriptions","organizations_url":"https://api.github.com/users/jmeas/orgs","repos_url":"https://api.github.com/users/jmeas/repos","events_url":"https://api.github.com/users/jmeas/events{/privacy}","received_events_url":"https://api.github.com/users/jmeas/received_events","type":"User","site_admin":false},"open_issues":46,"closed_issues":45,"state":"open","created_at":"2014-10-08T04:44:25Z","updated_at":"2016-08-17T08:27:13Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-08-15T15:59:15Z","updated_at":"2016-08-17T08:27:13Z","closed_at":"2016-08-17T08:27:13Z","body":"### Description\r\n\r\nWhen re-rendering a view, its child views get re-rendered as well even when that might not be necessary.\r\nIf regions/child views could be marked as persistent, Marionette would simply detach a child view and reattach it after the region is re-rendered.\r\n\r\nThis would probably require a way to explicitly provide a generator function so Marionette could generate a view itself.\r\n\r\n### Expected behavior\r\n\r\nWhat I am trying to achieve is this:\r\n\r\n```js\r\nSomeView = Mn.View.extend({\r\n\r\n\tmodelEvents: function() {\r\n\t\treturn {\r\n\t\t\t'change': 'render'\r\n\t\t};\r\n\t},\r\n\t\r\n\tregions: {\r\n\t\teditor: '.editor-region'\r\n\t},\r\n\t\r\n\tchildRenderers: {\r\n                editor: function() { return new EditorView(); }\r\n\t},\r\n```\r\n\r\nNow, when the model changes, causing a re-render of SomeView, it's editor (which may contain edited state) is not destroyed and simply re-attached (same View instance/cid, same region $el).\r\n\r\n### Actual behavior\r\n\r\nCurrently, this is rather hard to achieve:\r\n```js\r\n\tregions: {\r\n\t\teditor: '.editor-region'\r\n\t},\r\n\t\r\n\tonRender: function() {\r\n\t\tif ( ! this.cachedEditor) {\r\n\t\t\tthis.cachedEditor = new EditorView();\r\n\t\t}\r\n\t\tthis.showChildView('editor', this.cachedEditor);\r\n\t},\r\n```\r\n\r\nThis will raise a ```ViewDestroyedError``` for the EditorView. Now, I could hook into the unload hooks and detach the Editor before SomeView is re-rendered and remove it in a non-destructive way, but it seems this is functionality best suited for Marionette proper.\r\n\r\n### Environment\r\n\r\n1. Marionette version: 3.0.0.0 pre 5\r\n2. Backbone version: 1.3.3\r\n"},"comment":{"url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/comments/240346749","html_url":"https://github.com/marionettejs/backbone.marionette/issues/3124#issuecomment-240346749","issue_url":"https://api.github.com/repos/marionettejs/backbone.marionette/issues/3124","id":240346749,"user":{"login":"rbu","id":65913,"avatar_url":"https://avatars.githubusercontent.com/u/65913?v=3","gravatar_id":"","url":"https://api.github.com/users/rbu","html_url":"https://github.com/rbu","followers_url":"https://api.github.com/users/rbu/followers","following_url":"https://api.github.com/users/rbu/following{/other_user}","gists_url":"https://api.github.com/users/rbu/gists{/gist_id}","starred_url":"https://api.github.com/users/rbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbu/subscriptions","organizations_url":"https://api.github.com/users/rbu/orgs","repos_url":"https://api.github.com/users/rbu/repos","events_url":"https://api.github.com/users/rbu/events{/privacy}","received_events_url":"https://api.github.com/users/rbu/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T08:27:13Z","updated_at":"2016-08-17T08:27:13Z","body":"@paulfalgout, sorry for reporting a duplicate and thank you for finding the original. That issue is pretty much what I meant to report. Hoping for this to land with the region changes you mentioned."}}
{"actor":{"display_login":"rbu"}}