{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/horse-react/pulls/comments/39544973","id":39544973,"diff_hunk":"@@ -50,14 +71,36 @@ class ServerReactApp extends App {\n         yield app.route(this);\n       }\n \n-      if (typeof this.body === 'object' && React.isValidElement(this.body)) {\n+      if (typeof this.body === 'function') {\n+        // Load all the data required for the request before the server renders\n+        var data;\n+        this.props = this.props || {};\n+\n+        try {\n+          data = yield app.loadData;\n+        } catch (e) {\n+          app.error(e, this, app);\n+        }\n+\n+        this.props.dataCache = {};\n+\n+        if (data) {\n+          // The entries are in the same order as when we fired off the promises;\n+          // load the data from the response array.\n+          var i = 0;\n+          for (var [key, value] of this.props.data.entries()) {\n+            this.props.dataCache[key] = data[i];\n+            i++;\n+          }\n+        }\n+\n         yield app.render;\n \n         if (formatProps) {\n           this.props = formatProps(this.props);\n         }\n \n-        yield app.injectBootstrap;\n+        yield app.injectBootstrap(app.config.formatBootstrap);","path":"src/server.es6.js","position":119,"original_position":119,"commit_id":"2dce835429c02fe00052ef6d06e848bcaa53d525","original_commit_id":"2dce835429c02fe00052ef6d06e848bcaa53d525","user":{"login":"ajacksified","id":175515,"avatar_url":"https://avatars.githubusercontent.com/u/175515?v=3","gravatar_id":"","url":"https://api.github.com/users/ajacksified","html_url":"https://github.com/ajacksified","followers_url":"https://api.github.com/users/ajacksified/followers","following_url":"https://api.github.com/users/ajacksified/following{/other_user}","gists_url":"https://api.github.com/users/ajacksified/gists{/gist_id}","starred_url":"https://api.github.com/users/ajacksified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajacksified/subscriptions","organizations_url":"https://api.github.com/users/ajacksified/orgs","repos_url":"https://api.github.com/users/ajacksified/repos","events_url":"https://api.github.com/users/ajacksified/events{/privacy}","received_events_url":"https://api.github.com/users/ajacksified/received_events","type":"User","site_admin":false},"body":"A function would allow you to inject additional clientside-only config as well as whitelisting.","created_at":"2015-09-15T18:09:25Z","updated_at":"2015-09-15T18:09:25Z","html_url":"https://github.com/reddit/horse-react/pull/4#discussion_r39544973","pull_request_url":"https://api.github.com/repos/reddit/horse-react/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/reddit/horse-react/pulls/comments/39544973"},"html":{"href":"https://github.com/reddit/horse-react/pull/4#discussion_r39544973"},"pull_request":{"href":"https://api.github.com/repos/reddit/horse-react/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/horse-react/pulls/4","id":43465385,"html_url":"https://github.com/reddit/horse-react/pull/4","diff_url":"https://github.com/reddit/horse-react/pull/4.diff","patch_url":"https://github.com/reddit/horse-react/pull/4.patch","issue_url":"https://api.github.com/repos/reddit/horse-react/issues/4","number":4,"state":"open","locked":false,"title":"Refactor to support map of promises for loading data","user":{"login":"ajacksified","id":175515,"avatar_url":"https://avatars.githubusercontent.com/u/175515?v=3","gravatar_id":"","url":"https://api.github.com/users/ajacksified","html_url":"https://github.com/ajacksified","followers_url":"https://api.github.com/users/ajacksified/followers","following_url":"https://api.github.com/users/ajacksified/following{/other_user}","gists_url":"https://api.github.com/users/ajacksified/gists{/gist_id}","starred_url":"https://api.github.com/users/ajacksified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajacksified/subscriptions","organizations_url":"https://api.github.com/users/ajacksified/orgs","repos_url":"https://api.github.com/users/ajacksified/repos","events_url":"https://api.github.com/users/ajacksified/events{/privacy}","received_events_url":"https://api.github.com/users/ajacksified/received_events","type":"User","site_admin":false},"body":"Breaking changes:\r\n\r\n* `context.body` is now a function that takes one parameter, `props`.\r\nThis allows properties to be asynchronously loaded, and the body to be\r\ninstantiated once asynchronous properties have resolved.\r\n* `context.props.data` is now a map of keys/promises. The server will\r\nwait for all promises to resolve before rendering the body. Previously,\r\nroutes would `yield` promise results. This change allows the client side\r\nto asynchronously render components as data resolves, rather than\r\nwaiting for all data to resolve before rendering.\r\n\r\nWill be a major version change (v1.0.0).\r\n\r\n:eyeglasses: @curioussavage and @dwick ","created_at":"2015-08-26T23:48:08Z","updated_at":"2015-09-15T18:09:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbcfcc8554d3a05d426f22fb69c9aa31e65d9fa1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reddit/horse-react/pulls/4/commits","review_comments_url":"https://api.github.com/repos/reddit/horse-react/pulls/4/comments","review_comment_url":"https://api.github.com/repos/reddit/horse-react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reddit/horse-react/issues/4/comments","statuses_url":"https://api.github.com/repos/reddit/horse-react/statuses/2dce835429c02fe00052ef6d06e848bcaa53d525","head":{"label":"ajacksified:refactor-populateData","ref":"refactor-populateData","sha":"2dce835429c02fe00052ef6d06e848bcaa53d525","user":{"login":"ajacksified","id":175515,"avatar_url":"https://avatars.githubusercontent.com/u/175515?v=3","gravatar_id":"","url":"https://api.github.com/users/ajacksified","html_url":"https://github.com/ajacksified","followers_url":"https://api.github.com/users/ajacksified/followers","following_url":"https://api.github.com/users/ajacksified/following{/other_user}","gists_url":"https://api.github.com/users/ajacksified/gists{/gist_id}","starred_url":"https://api.github.com/users/ajacksified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajacksified/subscriptions","organizations_url":"https://api.github.com/users/ajacksified/orgs","repos_url":"https://api.github.com/users/ajacksified/repos","events_url":"https://api.github.com/users/ajacksified/events{/privacy}","received_events_url":"https://api.github.com/users/ajacksified/received_events","type":"User","site_admin":false},"repo":{"id":31563890,"name":"horse-react","full_name":"ajacksified/horse-react","owner":{"login":"ajacksified","id":175515,"avatar_url":"https://avatars.githubusercontent.com/u/175515?v=3","gravatar_id":"","url":"https://api.github.com/users/ajacksified","html_url":"https://github.com/ajacksified","followers_url":"https://api.github.com/users/ajacksified/followers","following_url":"https://api.github.com/users/ajacksified/following{/other_user}","gists_url":"https://api.github.com/users/ajacksified/gists{/gist_id}","starred_url":"https://api.github.com/users/ajacksified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajacksified/subscriptions","organizations_url":"https://api.github.com/users/ajacksified/orgs","repos_url":"https://api.github.com/users/ajacksified/repos","events_url":"https://api.github.com/users/ajacksified/events{/privacy}","received_events_url":"https://api.github.com/users/ajacksified/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajacksified/horse-react","description":"","fork":true,"url":"https://api.github.com/repos/ajacksified/horse-react","forks_url":"https://api.github.com/repos/ajacksified/horse-react/forks","keys_url":"https://api.github.com/repos/ajacksified/horse-react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajacksified/horse-react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajacksified/horse-react/teams","hooks_url":"https://api.github.com/repos/ajacksified/horse-react/hooks","issue_events_url":"https://api.github.com/repos/ajacksified/horse-react/issues/events{/number}","events_url":"https://api.github.com/repos/ajacksified/horse-react/events","assignees_url":"https://api.github.com/repos/ajacksified/horse-react/assignees{/user}","branches_url":"https://api.github.com/repos/ajacksified/horse-react/branches{/branch}","tags_url":"https://api.github.com/repos/ajacksified/horse-react/tags","blobs_url":"https://api.github.com/repos/ajacksified/horse-react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajacksified/horse-react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajacksified/horse-react/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajacksified/horse-react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajacksified/horse-react/statuses/{sha}","languages_url":"https://api.github.com/repos/ajacksified/horse-react/languages","stargazers_url":"https://api.github.com/repos/ajacksified/horse-react/stargazers","contributors_url":"https://api.github.com/repos/ajacksified/horse-react/contributors","subscribers_url":"https://api.github.com/repos/ajacksified/horse-react/subscribers","subscription_url":"https://api.github.com/repos/ajacksified/horse-react/subscription","commits_url":"https://api.github.com/repos/ajacksified/horse-react/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajacksified/horse-react/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajacksified/horse-react/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajacksified/horse-react/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajacksified/horse-react/contents/{+path}","compare_url":"https://api.github.com/repos/ajacksified/horse-react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajacksified/horse-react/merges","archive_url":"https://api.github.com/repos/ajacksified/horse-react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajacksified/horse-react/downloads","issues_url":"https://api.github.com/repos/ajacksified/horse-react/issues{/number}","pulls_url":"https://api.github.com/repos/ajacksified/horse-react/pulls{/number}","milestones_url":"https://api.github.com/repos/ajacksified/horse-react/milestones{/number}","notifications_url":"https://api.github.com/repos/ajacksified/horse-react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajacksified/horse-react/labels{/name}","releases_url":"https://api.github.com/repos/ajacksified/horse-react/releases{/id}","created_at":"2015-03-02T21:22:04Z","updated_at":"2015-04-22T04:56:14Z","pushed_at":"2015-09-15T05:33:04Z","git_url":"git://github.com/ajacksified/horse-react.git","ssh_url":"git@github.com:ajacksified/horse-react.git","clone_url":"https://github.com/ajacksified/horse-react.git","svn_url":"https://github.com/ajacksified/horse-react","homepage":null,"size":176,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reddit:master","ref":"master","sha":"8b53f0d83ce568ebef7a71fd7776866a629543e6","user":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"repo":{"id":31384316,"name":"horse-react","full_name":"reddit/horse-react","owner":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reddit/horse-react","description":"","fork":false,"url":"https://api.github.com/repos/reddit/horse-react","forks_url":"https://api.github.com/repos/reddit/horse-react/forks","keys_url":"https://api.github.com/repos/reddit/horse-react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reddit/horse-react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reddit/horse-react/teams","hooks_url":"https://api.github.com/repos/reddit/horse-react/hooks","issue_events_url":"https://api.github.com/repos/reddit/horse-react/issues/events{/number}","events_url":"https://api.github.com/repos/reddit/horse-react/events","assignees_url":"https://api.github.com/repos/reddit/horse-react/assignees{/user}","branches_url":"https://api.github.com/repos/reddit/horse-react/branches{/branch}","tags_url":"https://api.github.com/repos/reddit/horse-react/tags","blobs_url":"https://api.github.com/repos/reddit/horse-react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reddit/horse-react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reddit/horse-react/git/refs{/sha}","trees_url":"https://api.github.com/repos/reddit/horse-react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reddit/horse-react/statuses/{sha}","languages_url":"https://api.github.com/repos/reddit/horse-react/languages","stargazers_url":"https://api.github.com/repos/reddit/horse-react/stargazers","contributors_url":"https://api.github.com/repos/reddit/horse-react/contributors","subscribers_url":"https://api.github.com/repos/reddit/horse-react/subscribers","subscription_url":"https://api.github.com/repos/reddit/horse-react/subscription","commits_url":"https://api.github.com/repos/reddit/horse-react/commits{/sha}","git_commits_url":"https://api.github.com/repos/reddit/horse-react/git/commits{/sha}","comments_url":"https://api.github.com/repos/reddit/horse-react/comments{/number}","issue_comment_url":"https://api.github.com/repos/reddit/horse-react/issues/comments{/number}","contents_url":"https://api.github.com/repos/reddit/horse-react/contents/{+path}","compare_url":"https://api.github.com/repos/reddit/horse-react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reddit/horse-react/merges","archive_url":"https://api.github.com/repos/reddit/horse-react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reddit/horse-react/downloads","issues_url":"https://api.github.com/repos/reddit/horse-react/issues{/number}","pulls_url":"https://api.github.com/repos/reddit/horse-react/pulls{/number}","milestones_url":"https://api.github.com/repos/reddit/horse-react/milestones{/number}","notifications_url":"https://api.github.com/repos/reddit/horse-react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reddit/horse-react/labels{/name}","releases_url":"https://api.github.com/repos/reddit/horse-react/releases{/id}","created_at":"2015-02-26T19:19:46Z","updated_at":"2015-07-04T15:48:25Z","pushed_at":"2015-09-15T05:33:05Z","git_url":"git://github.com/reddit/horse-react.git","ssh_url":"git@github.com:reddit/horse-react.git","clone_url":"https://github.com/reddit/horse-react.git","svn_url":"https://github.com/reddit/horse-react","homepage":null,"size":231,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/horse-react/pulls/4"},"html":{"href":"https://github.com/reddit/horse-react/pull/4"},"issue":{"href":"https://api.github.com/repos/reddit/horse-react/issues/4"},"comments":{"href":"https://api.github.com/repos/reddit/horse-react/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/horse-react/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/reddit/horse-react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reddit/horse-react/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/horse-react/statuses/2dce835429c02fe00052ef6d06e848bcaa53d525"}}}}