{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/hypernova/issues/22","repository_url":"https://api.github.com/repos/airbnb/hypernova","labels_url":"https://api.github.com/repos/airbnb/hypernova/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/hypernova/issues/22/comments","events_url":"https://api.github.com/repos/airbnb/hypernova/issues/22/events","html_url":"https://github.com/airbnb/hypernova/issues/22","id":162618766,"number":22,"title":"`createGetComponent` doesn't prevent leaking data between requests","user":{"login":"alexindigo","id":127063,"avatar_url":"https://avatars.githubusercontent.com/u/127063?v=3","gravatar_id":"","url":"https://api.github.com/users/alexindigo","html_url":"https://github.com/alexindigo","followers_url":"https://api.github.com/users/alexindigo/followers","following_url":"https://api.github.com/users/alexindigo/following{/other_user}","gists_url":"https://api.github.com/users/alexindigo/gists{/gist_id}","starred_url":"https://api.github.com/users/alexindigo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexindigo/subscriptions","organizations_url":"https://api.github.com/users/alexindigo/orgs","repos_url":"https://api.github.com/users/alexindigo/repos","events_url":"https://api.github.com/users/alexindigo/events{/privacy}","received_events_url":"https://api.github.com/users/alexindigo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/airbnb/hypernova/labels/bug","name":"bug","color":"ee0701"},{"url":"https://api.github.com/repos/airbnb/hypernova/labels/documentation","name":"documentation","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-28T07:20:47Z","updated_at":"2016-06-30T19:35:40Z","closed_at":null,"body":"As per documentation: `The most common use-case would be to use a VM to keep each module sandboxed between requests. You can use createGetComponent from Hypernova to retrieve a getComponent function that does this.`\r\n\r\nI'm using `createGetComponent` to load following component:\r\n\r\n```\r\nimport React from 'react';\r\nimport { renderReact } from 'hypernova-react';\r\n\r\nlet meme = 25;\r\n\r\nfunction SimpleComponent({ name }) {\r\n  return <div onClick={() => alert('Click handlers work.')}>Hello, {meme++}, {name}!</div>;\r\n}\r\n\r\nexport default renderReact('SimpleComponent', SimpleComponent);\r\n```\r\n\r\nwith following getComponent function\r\n\r\n```\r\n  getComponent: createGetComponent({\r\n    SimpleComponent: path.resolve('build/components/SimpleComponent/index.js'),\r\n    Counter: path.resolve('build/components/Counter/index.js')\r\n  }),\r\n```\r\n\r\nAnd `meme` counter keeps ticking:\r\n\r\n![incrementing value](http://ia.gs/gZEA/Screen%20Recording%202016-06-28%20at%2012.10%20AM.gif)\r\n"},"comment":{"url":"https://api.github.com/repos/airbnb/hypernova/issues/comments/229765319","html_url":"https://github.com/airbnb/hypernova/issues/22#issuecomment-229765319","issue_url":"https://api.github.com/repos/airbnb/hypernova/issues/22","id":229765319,"user":{"login":"goatslacker","id":10632,"avatar_url":"https://avatars.githubusercontent.com/u/10632?v=3","gravatar_id":"","url":"https://api.github.com/users/goatslacker","html_url":"https://github.com/goatslacker","followers_url":"https://api.github.com/users/goatslacker/followers","following_url":"https://api.github.com/users/goatslacker/following{/other_user}","gists_url":"https://api.github.com/users/goatslacker/gists{/gist_id}","starred_url":"https://api.github.com/users/goatslacker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goatslacker/subscriptions","organizations_url":"https://api.github.com/users/goatslacker/orgs","repos_url":"https://api.github.com/users/goatslacker/repos","events_url":"https://api.github.com/users/goatslacker/events{/privacy}","received_events_url":"https://api.github.com/users/goatslacker/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T19:35:40Z","updated_at":"2016-06-30T19:35:40Z","body":"I marked it as a bug + documentation because it can be both. Either we fix the issue or we amend the documentation to make it explicit that using `createVM` and `createGetComponent` will leak.\r\n\r\nIt's a tough situation because if you don't have a caching layer then you're adding server-render time to your total time. It's not cheap to eval code.\r\n\r\nThere are a few things you can do to make things faster AND get the benefits of isolation. You'd have to basically pack all the code into a single bundle (webpack/browserify works) and then you can re-eval that inside a VM. I don't have numbers with me but that shouldn't add too much latency."}}
{"actor":{"display_login":"goatslacker"}}