{"action":"created","issue":{"url":"https://api.github.com/repos/hyperapp/hyperapp/issues/378","repository_url":"https://api.github.com/repos/hyperapp/hyperapp","labels_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/378/labels{/name}","comments_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/378/comments","events_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/378/events","html_url":"https://github.com/hyperapp/hyperapp/pull/378","id":259045469,"number":378,"title":"add short circuit for patching memoized vnodes","user":{"login":"andyrj","id":5376837,"avatar_url":"https://avatars1.githubusercontent.com/u/5376837?v=4","gravatar_id":"","url":"https://api.github.com/users/andyrj","html_url":"https://github.com/andyrj","followers_url":"https://api.github.com/users/andyrj/followers","following_url":"https://api.github.com/users/andyrj/following{/other_user}","gists_url":"https://api.github.com/users/andyrj/gists{/gist_id}","starred_url":"https://api.github.com/users/andyrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyrj/subscriptions","organizations_url":"https://api.github.com/users/andyrj/orgs","repos_url":"https://api.github.com/users/andyrj/repos","events_url":"https://api.github.com/users/andyrj/events{/privacy}","received_events_url":"https://api.github.com/users/andyrj/received_events","type":"User","site_admin":false},"labels":[{"id":522275185,"url":"https://api.github.com/repos/hyperapp/hyperapp/labels/ENHANCEMENT","name":"ENHANCEMENT","color":"16B0E1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-09-20T05:39:09Z","updated_at":"2017-11-05T04:19:12Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/hyperapp/hyperapp/pulls/378","html_url":"https://github.com/hyperapp/hyperapp/pull/378","diff_url":"https://github.com/hyperapp/hyperapp/pull/378.diff","patch_url":"https://github.com/hyperapp/hyperapp/pull/378.patch"},"body":"this adds a short circuit to patch for memoized components...\r\n\r\nexample memoize:\r\n```js\r\n/*\r\n* memoize.js\r\n* by @philogb and @addyosmani\r\n* with further optimizations by @mathias\r\n* and @DmitryBaranovsk\r\n* perf tests: http://bit.ly/q3zpG3\r\n* Released under an MIT license.\r\n*/\r\nfunction memoize( fn ) {\r\n    return function () {\r\n        var args = Array.prototype.slice.call(arguments),\r\n            hash = \"\",\r\n            i = args.length;\r\n        currentArg = null;\r\n        while (i--) {\r\n            currentArg = args[i];\r\n            hash += (currentArg === Object(currentArg)) ?\r\n            JSON.stringify(currentArg) : currentArg;\r\n            fn.memoize || (fn.memoize = {});\r\n        }\r\n        return (hash in fn.memoize) ? fn.memoize[hash] :\r\n        fn.memoize[hash] = fn.apply(this, args);\r\n    };\r\n}\r\n```\r\n\r\nUsers would wrap their components/view with this method to skip patching vnodes which have not changed.\r\n\r\nThis PR satisifies the following issue: https://github.com/hyperapp/hyperapp/issues/373"},"comment":{"url":"https://api.github.com/repos/hyperapp/hyperapp/issues/comments/341948150","html_url":"https://github.com/hyperapp/hyperapp/pull/378#issuecomment-341948150","issue_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/378","id":341948150,"user":{"login":"lukejacksonn","id":1457604,"avatar_url":"https://avatars1.githubusercontent.com/u/1457604?v=4","gravatar_id":"","url":"https://api.github.com/users/lukejacksonn","html_url":"https://github.com/lukejacksonn","followers_url":"https://api.github.com/users/lukejacksonn/followers","following_url":"https://api.github.com/users/lukejacksonn/following{/other_user}","gists_url":"https://api.github.com/users/lukejacksonn/gists{/gist_id}","starred_url":"https://api.github.com/users/lukejacksonn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukejacksonn/subscriptions","organizations_url":"https://api.github.com/users/lukejacksonn/orgs","repos_url":"https://api.github.com/users/lukejacksonn/repos","events_url":"https://api.github.com/users/lukejacksonn/events{/privacy}","received_events_url":"https://api.github.com/users/lukejacksonn/received_events","type":"User","site_admin":false},"created_at":"2017-11-05T04:19:12Z","updated_at":"2017-11-05T04:19:12Z","author_association":"MEMBER","body":"I was just going through issues and came from https://github.com/hyperapp/hyperapp/issues/373#issuecomment-341914817 to here.. when I first read this PR description (and graphs :100: ) I thought wow this is awesome, but assumed for some reason that we would need to include the memoize function in core.. but this is not the case, right? Just an equality check will suffice. Which will always return false unless you have wrapped your component with memoize in userland. If I am understanding this correctly then what have we got against the idea?"}}
{"actor":{"display_login":"lukejacksonn"}}