{"action":"created","issue":{"url":"https://api.github.com/repos/Matt-Esch/virtual-dom/issues/343","labels_url":"https://api.github.com/repos/Matt-Esch/virtual-dom/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/Matt-Esch/virtual-dom/issues/343/comments","events_url":"https://api.github.com/repos/Matt-Esch/virtual-dom/issues/343/events","html_url":"https://github.com/Matt-Esch/virtual-dom/issues/343","id":122153397,"number":343,"title":"Efficient Subtree Patching Proposal","user":{"login":"Zolmeister","id":700546,"avatar_url":"https://avatars.githubusercontent.com/u/700546?v=3","gravatar_id":"","url":"https://api.github.com/users/Zolmeister","html_url":"https://github.com/Zolmeister","followers_url":"https://api.github.com/users/Zolmeister/followers","following_url":"https://api.github.com/users/Zolmeister/following{/other_user}","gists_url":"https://api.github.com/users/Zolmeister/gists{/gist_id}","starred_url":"https://api.github.com/users/Zolmeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zolmeister/subscriptions","organizations_url":"https://api.github.com/users/Zolmeister/orgs","repos_url":"https://api.github.com/users/Zolmeister/repos","events_url":"https://api.github.com/users/Zolmeister/events{/privacy}","received_events_url":"https://api.github.com/users/Zolmeister/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-14T23:09:12Z","updated_at":"2015-12-16T00:45:32Z","closed_at":null,"body":"Stemming from https://github.com/Matt-Esch/virtual-dom/issues/304, having an efficient way to update components in-place. This solution is designed as an extension of hooks on top of thunks.\r\n\r\n```js\r\nvar Hook = function(state, render){\r\n  this.state = state\r\n  this.render = render\r\n}\r\n// The new render method here is what's important\r\n// It updates the root v-tree (by mutation... or something efficient)\r\nHook.prototype.hook = function(node, propertyName, previousValue, render) { // render\r\n  this.disposable = this.state.subscribe(function() {\r\n    render(this.render()) // render v-tree, patch contents of thunk, render to DOM\r\n  }\r\n}\r\nHook.prototype.unhook = function() {\r\n  this.disposable.dispose()\r\n}\r\nvar Thunk = function(){\r\n  this.state = Rx.BehaviorSubject()\r\n  this.hook = new Hook(this.state, this.render)\r\n}\r\nThunk.prototype.type = 'thunk'\r\nThunk.prototype.render = function(previous) {\r\n   return h('div', 'Hello World')\r\n}\r\ncreateElement(new Thunk(){})\r\n```"},"comment":{"url":"https://api.github.com/repos/Matt-Esch/virtual-dom/issues/comments/164947104","html_url":"https://github.com/Matt-Esch/virtual-dom/issues/343#issuecomment-164947104","issue_url":"https://api.github.com/repos/Matt-Esch/virtual-dom/issues/343","id":164947104,"user":{"login":"Zolmeister","id":700546,"avatar_url":"https://avatars.githubusercontent.com/u/700546?v=3","gravatar_id":"","url":"https://api.github.com/users/Zolmeister","html_url":"https://github.com/Zolmeister","followers_url":"https://api.github.com/users/Zolmeister/followers","following_url":"https://api.github.com/users/Zolmeister/following{/other_user}","gists_url":"https://api.github.com/users/Zolmeister/gists{/gist_id}","starred_url":"https://api.github.com/users/Zolmeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zolmeister/subscriptions","organizations_url":"https://api.github.com/users/Zolmeister/orgs","repos_url":"https://api.github.com/users/Zolmeister/repos","events_url":"https://api.github.com/users/Zolmeister/events{/privacy}","received_events_url":"https://api.github.com/users/Zolmeister/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T00:45:32Z","updated_at":"2015-12-16T00:45:32Z","body":"@kuraga 2-fold.\r\n1. Adding hooks to Thunks (which I don't think exist right now)\r\n2. extending the hook function signature with a new 'render' function which updates the tree in-place"}}