{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/8595","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/8595/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/8595/comments","events_url":"https://api.github.com/repos/facebook/react/issues/8595/events","html_url":"https://github.com/facebook/react/pull/8595","id":196248364,"number":8595,"title":"[Fiber][Not for commit] Proof-of-concept: Promise as element type","user":{"login":"acdlite","id":3624098,"avatar_url":"https://avatars.githubusercontent.com/u/3624098?v=3","gravatar_id":"","url":"https://api.github.com/users/acdlite","html_url":"https://github.com/acdlite","followers_url":"https://api.github.com/users/acdlite/followers","following_url":"https://api.github.com/users/acdlite/following{/other_user}","gists_url":"https://api.github.com/users/acdlite/gists{/gist_id}","starred_url":"https://api.github.com/users/acdlite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acdlite/subscriptions","organizations_url":"https://api.github.com/users/acdlite/orgs","repos_url":"https://api.github.com/users/acdlite/repos","events_url":"https://api.github.com/users/acdlite/events{/privacy}","received_events_url":"https://api.github.com/users/acdlite/received_events","type":"User","site_admin":false},"labels":[{"id":196858374,"url":"https://api.github.com/repos/facebook/react/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7","default":false},{"id":130714623,"url":"https://api.github.com/repos/facebook/react/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-17T23:19:23Z","updated_at":"2016-12-17T23:45:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/8595","html_url":"https://github.com/facebook/react/pull/8595","diff_url":"https://github.com/facebook/react/pull/8595.diff","patch_url":"https://github.com/facebook/react/pull/8595.patch"},"body":"For fun, here's a proof-of-concept based on an idea by @sebmarkbage.\r\n\r\nIf a promise is passed to `React.createElement`, on initial mount, React waits for the promise to resolve to a React element type. Meanwhile, it bails out and continues rendering elsewhere. Once the promise resolves, React renders using the resolved element type. Subsequent renders are not deferred and behave just like a regular element.\r\n\r\nSuch a feature could be useful alongside dynamic [`import()`](https://github.com/tc39/proposal-dynamic-import) (currently stage 3):\r\n\r\n```js\r\n// Stage 3 import()\r\nconst MyComponent = import('MyComponent');\r\n// MyComponent is a promise that resolves to a normal React class/function\r\n\r\nfunction ParentComponent() {\r\n  // Use it with JSX like you normally would. It will render once the promise resolves.\r\n  return <MyComponent prop=\"whatever\" />;\r\n}\r\n```\r\n\r\n(Again, this is just an experiment and only implemented in Fiber. It may never see public release.)"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/267794338","html_url":"https://github.com/facebook/react/pull/8595#issuecomment-267794338","issue_url":"https://api.github.com/repos/facebook/react/issues/8595","id":267794338,"user":{"login":"acdlite","id":3624098,"avatar_url":"https://avatars.githubusercontent.com/u/3624098?v=3","gravatar_id":"","url":"https://api.github.com/users/acdlite","html_url":"https://github.com/acdlite","followers_url":"https://api.github.com/users/acdlite/followers","following_url":"https://api.github.com/users/acdlite/following{/other_user}","gists_url":"https://api.github.com/users/acdlite/gists{/gist_id}","starred_url":"https://api.github.com/users/acdlite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acdlite/subscriptions","organizations_url":"https://api.github.com/users/acdlite/orgs","repos_url":"https://api.github.com/users/acdlite/repos","events_url":"https://api.github.com/users/acdlite/events{/privacy}","received_events_url":"https://api.github.com/users/acdlite/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T23:45:24Z","updated_at":"2016-12-17T23:45:24Z","body":"Could you implement this using a new priority field, e.g. `blockedWorkPriority`, that represents the priority of work in that subtree that is \"blocked\" by a promise? Then in the commit phase you compare the work priority to the blocked priority."}}
{"actor":{"display_login":"acdlite"}}