{"action":"created","comment":{"url":"https://api.github.com/repos/hollowverse/hollowverse/pulls/comments/150424420","pull_request_review_id":75972347,"id":150424420,"diff_hunk":"@@ -0,0 +1,160 @@\n+/**\n+ * FbComments Component\n+ */\n+import * as React from 'react';\n+import { importGlobalScript } from 'helpers/importGlobalScript';\n+import { MessageWithIcon } from 'components/MessageWithIcon';\n+import { LoadingSpinner } from 'components/LoadingSpinner';\n+import { SvgIcon } from 'components/SvgIcon';\n+import { delay } from 'helpers/time';\n+\n+import warningIcon from 'icons/warning.svg';\n+\n+const loadingComponent = (\n+  <MessageWithIcon\n+    caption=\"Loading Facebook comments...\"\n+    icon={<LoadingSpinner size={50} />}\n+  />\n+);\n+\n+type P = {\n+  url: string;\n+  numPosts?: number;\n+\n+  /**\n+   * Time in milliseconds after which loading is considered to have failed\n+   * Defaults to `6000`. If `null`, loading never times out.\n+   */\n+  timeout?: number | null;\n+};\n+\n+type S = {\n+  isLoading: boolean;\n+  hasError: boolean;\n+  timedOut: boolean;\n+};\n+\n+const OBSERVED_FB_ATTR_NAME = 'fb-xfbml-state';\n+\n+/** Facebook Comments Plugin */\n+export class FbComments extends React.PureComponent<P, S> {\n+  static defaultProps: Partial<P> = {\n+    timeout: 20000,\n+  };\n+\n+  state: S = {\n+    isLoading: true,\n+    hasError: false,\n+    timedOut: false,\n+  };\n+\n+  target: HTMLDivElement | null;\n+  commentsObserver: MutationObserver | null = null;\n+\n+  setTarget = (node: HTMLDivElement | null) => (this.target = node);\n+\n+  observeCommentsRendered = async () =>\n+    new Promise(resolve => {\n+      if (MutationObserver === undefined) {\n+        resolve();\n+      } else if (this.target) {\n+        this.commentsObserver = new MutationObserver(mutations => {\n+          mutations.forEach(mutation => {\n+            if (\n+              mutation.attributeName === OBSERVED_FB_ATTR_NAME &&\n+              mutation.target.attributes.getNamedItem(OBSERVED_FB_ATTR_NAME)\n+                .value === 'rendered'\n+            ) {\n+              resolve();\n+              if (this.commentsObserver) {\n+                this.commentsObserver.disconnect();\n+              }\n+            }\n+          });\n+        });\n+\n+        this.commentsObserver.observe(this.target, {\n+          childList: false,\n+          attributeOldValue: false,\n+          attributeFilter: [OBSERVED_FB_ATTR_NAME],\n+        });\n+      }\n+    });\n+\n+  tryLoading = () => {\n+    this.setState({ isLoading: true, hasError: false, timedOut: false }, () => {","path":"client/src/components/FbComments/index.tsx","position":85,"original_position":85,"commit_id":"6f8a820ee786073f42fc7eea9c6f585f4b9d87c6","original_commit_id":"fce0ebb3b4226c6fe40bd1e8e9301980376f2c1b","user":{"login":"forabi","id":1012761,"avatar_url":"https://avatars2.githubusercontent.com/u/1012761?v=4","gravatar_id":"","url":"https://api.github.com/users/forabi","html_url":"https://github.com/forabi","followers_url":"https://api.github.com/users/forabi/followers","following_url":"https://api.github.com/users/forabi/following{/other_user}","gists_url":"https://api.github.com/users/forabi/gists{/gist_id}","starred_url":"https://api.github.com/users/forabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forabi/subscriptions","organizations_url":"https://api.github.com/users/forabi/orgs","repos_url":"https://api.github.com/users/forabi/repos","events_url":"https://api.github.com/users/forabi/events{/privacy}","received_events_url":"https://api.github.com/users/forabi/received_events","type":"User","site_admin":false},"body":"I think this should later be refactored into a more generic loadable component. But that's a different issue.\r\n\r\nI really dislike the idea of having _everything_ in a Redux store. It can sometimes make things more complicated and coupled to Redux even though they can be managed independently. I generally start with managing state at the component level and only move it up to the global store when it's actually needed. In the case of asynchronous loading, we may have multiple components loading at the same time, so how would be identify each one in a global store?\r\n","created_at":"2017-11-12T21:32:43Z","updated_at":"2017-11-12T21:32:43Z","html_url":"https://github.com/hollowverse/hollowverse/pull/199#discussion_r150424420","pull_request_url":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hollowverse/hollowverse/pulls/comments/150424420"},"html":{"href":"https://github.com/hollowverse/hollowverse/pull/199#discussion_r150424420"},"pull_request":{"href":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199"}},"in_reply_to_id":150423920},"pull_request":{"url":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199","id":150364350,"html_url":"https://github.com/hollowverse/hollowverse/pull/199","diff_url":"https://github.com/hollowverse/hollowverse/pull/199.diff","patch_url":"https://github.com/hollowverse/hollowverse/pull/199.patch","issue_url":"https://api.github.com/repos/hollowverse/hollowverse/issues/199","number":199,"state":"open","locked":false,"title":"Implement new page for Tom Hanks","user":{"login":"forabi","id":1012761,"avatar_url":"https://avatars2.githubusercontent.com/u/1012761?v=4","gravatar_id":"","url":"https://api.github.com/users/forabi","html_url":"https://github.com/forabi","followers_url":"https://api.github.com/users/forabi/followers","following_url":"https://api.github.com/users/forabi/following{/other_user}","gists_url":"https://api.github.com/users/forabi/gists{/gist_id}","starred_url":"https://api.github.com/users/forabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forabi/subscriptions","organizations_url":"https://api.github.com/users/forabi/orgs","repos_url":"https://api.github.com/users/forabi/repos","events_url":"https://api.github.com/users/forabi/events{/privacy}","received_events_url":"https://api.github.com/users/forabi/received_events","type":"User","site_admin":false},"body":"* [x] Connect page with production GraphQL API\r\n  * [x] ~Decide on which GraphQL client library to use (Apollo Client vs. Relay)~ [`graphql-request`](https://github.com/graphcool/graphql-request)\r\n* [ ] Check bundle sizes\r\n  * [ ] Create split points with dynamic `import()` where it makes sense\r\n* [ ] Use new favicon\r\n* [ ] Investigate feasibility of server-side rendering (#203)\r\n* [ ] Consider implementing service worker for [\"app shell\" model](https://developers.google.com/web/fundamentals/architecture/app-shell)\r\n* [x] Import components from [hollowverse/design](https://github.com/hollowverse/design)\r\n* [x] Make sure CORS is allowed for API (hollowverse/api#6)","created_at":"2017-11-02T18:04:20Z","updated_at":"2017-11-12T21:32:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60dcf3ee3511877757847e4db3675220f27be1b4","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199/commits","review_comments_url":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199/comments","review_comment_url":"https://api.github.com/repos/hollowverse/hollowverse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hollowverse/hollowverse/issues/199/comments","statuses_url":"https://api.github.com/repos/hollowverse/hollowverse/statuses/6f8a820ee786073f42fc7eea9c6f585f4b9d87c6","head":{"label":"forabi:import-design","ref":"import-design","sha":"6f8a820ee786073f42fc7eea9c6f585f4b9d87c6","user":{"login":"forabi","id":1012761,"avatar_url":"https://avatars2.githubusercontent.com/u/1012761?v=4","gravatar_id":"","url":"https://api.github.com/users/forabi","html_url":"https://github.com/forabi","followers_url":"https://api.github.com/users/forabi/followers","following_url":"https://api.github.com/users/forabi/following{/other_user}","gists_url":"https://api.github.com/users/forabi/gists{/gist_id}","starred_url":"https://api.github.com/users/forabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forabi/subscriptions","organizations_url":"https://api.github.com/users/forabi/orgs","repos_url":"https://api.github.com/users/forabi/repos","events_url":"https://api.github.com/users/forabi/events{/privacy}","received_events_url":"https://api.github.com/users/forabi/received_events","type":"User","site_admin":false},"repo":{"id":95765062,"name":"hollowverse","full_name":"forabi/hollowverse","owner":{"login":"forabi","id":1012761,"avatar_url":"https://avatars2.githubusercontent.com/u/1012761?v=4","gravatar_id":"","url":"https://api.github.com/users/forabi","html_url":"https://github.com/forabi","followers_url":"https://api.github.com/users/forabi/followers","following_url":"https://api.github.com/users/forabi/following{/other_user}","gists_url":"https://api.github.com/users/forabi/gists{/gist_id}","starred_url":"https://api.github.com/users/forabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forabi/subscriptions","organizations_url":"https://api.github.com/users/forabi/orgs","repos_url":"https://api.github.com/users/forabi/repos","events_url":"https://api.github.com/users/forabi/events{/privacy}","received_events_url":"https://api.github.com/users/forabi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/forabi/hollowverse","description":"The new Hollowverse.com","fork":true,"url":"https://api.github.com/repos/forabi/hollowverse","forks_url":"https://api.github.com/repos/forabi/hollowverse/forks","keys_url":"https://api.github.com/repos/forabi/hollowverse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/forabi/hollowverse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/forabi/hollowverse/teams","hooks_url":"https://api.github.com/repos/forabi/hollowverse/hooks","issue_events_url":"https://api.github.com/repos/forabi/hollowverse/issues/events{/number}","events_url":"https://api.github.com/repos/forabi/hollowverse/events","assignees_url":"https://api.github.com/repos/forabi/hollowverse/assignees{/user}","branches_url":"https://api.github.com/repos/forabi/hollowverse/branches{/branch}","tags_url":"https://api.github.com/repos/forabi/hollowverse/tags","blobs_url":"https://api.github.com/repos/forabi/hollowverse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/forabi/hollowverse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/forabi/hollowverse/git/refs{/sha}","trees_url":"https://api.github.com/repos/forabi/hollowverse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/forabi/hollowverse/statuses/{sha}","languages_url":"https://api.github.com/repos/forabi/hollowverse/languages","stargazers_url":"https://api.github.com/repos/forabi/hollowverse/stargazers","contributors_url":"https://api.github.com/repos/forabi/hollowverse/contributors","subscribers_url":"https://api.github.com/repos/forabi/hollowverse/subscribers","subscription_url":"https://api.github.com/repos/forabi/hollowverse/subscription","commits_url":"https://api.github.com/repos/forabi/hollowverse/commits{/sha}","git_commits_url":"https://api.github.com/repos/forabi/hollowverse/git/commits{/sha}","comments_url":"https://api.github.com/repos/forabi/hollowverse/comments{/number}","issue_comment_url":"https://api.github.com/repos/forabi/hollowverse/issues/comments{/number}","contents_url":"https://api.github.com/repos/forabi/hollowverse/contents/{+path}","compare_url":"https://api.github.com/repos/forabi/hollowverse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/forabi/hollowverse/merges","archive_url":"https://api.github.com/repos/forabi/hollowverse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/forabi/hollowverse/downloads","issues_url":"https://api.github.com/repos/forabi/hollowverse/issues{/number}","pulls_url":"https://api.github.com/repos/forabi/hollowverse/pulls{/number}","milestones_url":"https://api.github.com/repos/forabi/hollowverse/milestones{/number}","notifications_url":"https://api.github.com/repos/forabi/hollowverse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/forabi/hollowverse/labels{/name}","releases_url":"https://api.github.com/repos/forabi/hollowverse/releases{/id}","deployments_url":"https://api.github.com/repos/forabi/hollowverse/deployments","created_at":"2017-06-29T10:07:57Z","updated_at":"2017-06-29T10:07:59Z","pushed_at":"2017-11-12T21:20:31Z","git_url":"git://github.com/forabi/hollowverse.git","ssh_url":"git@github.com:forabi/hollowverse.git","clone_url":"https://github.com/forabi/hollowverse.git","svn_url":"https://github.com/forabi/hollowverse","homepage":"https://x.hollowverse.com","size":9341,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hollowverse:master","ref":"master","sha":"2f37ded65bfe4fc491132bf8f48407b86ad5eb20","user":{"login":"hollowverse","id":26698836,"avatar_url":"https://avatars0.githubusercontent.com/u/26698836?v=4","gravatar_id":"","url":"https://api.github.com/users/hollowverse","html_url":"https://github.com/hollowverse","followers_url":"https://api.github.com/users/hollowverse/followers","following_url":"https://api.github.com/users/hollowverse/following{/other_user}","gists_url":"https://api.github.com/users/hollowverse/gists{/gist_id}","starred_url":"https://api.github.com/users/hollowverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hollowverse/subscriptions","organizations_url":"https://api.github.com/users/hollowverse/orgs","repos_url":"https://api.github.com/users/hollowverse/repos","events_url":"https://api.github.com/users/hollowverse/events{/privacy}","received_events_url":"https://api.github.com/users/hollowverse/received_events","type":"Organization","site_admin":false},"repo":{"id":86410197,"name":"hollowverse","full_name":"hollowverse/hollowverse","owner":{"login":"hollowverse","id":26698836,"avatar_url":"https://avatars0.githubusercontent.com/u/26698836?v=4","gravatar_id":"","url":"https://api.github.com/users/hollowverse","html_url":"https://github.com/hollowverse","followers_url":"https://api.github.com/users/hollowverse/followers","following_url":"https://api.github.com/users/hollowverse/following{/other_user}","gists_url":"https://api.github.com/users/hollowverse/gists{/gist_id}","starred_url":"https://api.github.com/users/hollowverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hollowverse/subscriptions","organizations_url":"https://api.github.com/users/hollowverse/orgs","repos_url":"https://api.github.com/users/hollowverse/repos","events_url":"https://api.github.com/users/hollowverse/events{/privacy}","received_events_url":"https://api.github.com/users/hollowverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hollowverse/hollowverse","description":"The new Hollowverse.com","fork":false,"url":"https://api.github.com/repos/hollowverse/hollowverse","forks_url":"https://api.github.com/repos/hollowverse/hollowverse/forks","keys_url":"https://api.github.com/repos/hollowverse/hollowverse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hollowverse/hollowverse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hollowverse/hollowverse/teams","hooks_url":"https://api.github.com/repos/hollowverse/hollowverse/hooks","issue_events_url":"https://api.github.com/repos/hollowverse/hollowverse/issues/events{/number}","events_url":"https://api.github.com/repos/hollowverse/hollowverse/events","assignees_url":"https://api.github.com/repos/hollowverse/hollowverse/assignees{/user}","branches_url":"https://api.github.com/repos/hollowverse/hollowverse/branches{/branch}","tags_url":"https://api.github.com/repos/hollowverse/hollowverse/tags","blobs_url":"https://api.github.com/repos/hollowverse/hollowverse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hollowverse/hollowverse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hollowverse/hollowverse/git/refs{/sha}","trees_url":"https://api.github.com/repos/hollowverse/hollowverse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hollowverse/hollowverse/statuses/{sha}","languages_url":"https://api.github.com/repos/hollowverse/hollowverse/languages","stargazers_url":"https://api.github.com/repos/hollowverse/hollowverse/stargazers","contributors_url":"https://api.github.com/repos/hollowverse/hollowverse/contributors","subscribers_url":"https://api.github.com/repos/hollowverse/hollowverse/subscribers","subscription_url":"https://api.github.com/repos/hollowverse/hollowverse/subscription","commits_url":"https://api.github.com/repos/hollowverse/hollowverse/commits{/sha}","git_commits_url":"https://api.github.com/repos/hollowverse/hollowverse/git/commits{/sha}","comments_url":"https://api.github.com/repos/hollowverse/hollowverse/comments{/number}","issue_comment_url":"https://api.github.com/repos/hollowverse/hollowverse/issues/comments{/number}","contents_url":"https://api.github.com/repos/hollowverse/hollowverse/contents/{+path}","compare_url":"https://api.github.com/repos/hollowverse/hollowverse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hollowverse/hollowverse/merges","archive_url":"https://api.github.com/repos/hollowverse/hollowverse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hollowverse/hollowverse/downloads","issues_url":"https://api.github.com/repos/hollowverse/hollowverse/issues{/number}","pulls_url":"https://api.github.com/repos/hollowverse/hollowverse/pulls{/number}","milestones_url":"https://api.github.com/repos/hollowverse/hollowverse/milestones{/number}","notifications_url":"https://api.github.com/repos/hollowverse/hollowverse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hollowverse/hollowverse/labels{/name}","releases_url":"https://api.github.com/repos/hollowverse/hollowverse/releases{/id}","deployments_url":"https://api.github.com/repos/hollowverse/hollowverse/deployments","created_at":"2017-03-28T03:21:35Z","updated_at":"2017-09-21T11:39:50Z","pushed_at":"2017-11-12T21:20:32Z","git_url":"git://github.com/hollowverse/hollowverse.git","ssh_url":"git@github.com:hollowverse/hollowverse.git","clone_url":"https://github.com/hollowverse/hollowverse.git","svn_url":"https://github.com/hollowverse/hollowverse","homepage":"","size":8758,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199"},"html":{"href":"https://github.com/hollowverse/hollowverse/pull/199"},"issue":{"href":"https://api.github.com/repos/hollowverse/hollowverse/issues/199"},"comments":{"href":"https://api.github.com/repos/hollowverse/hollowverse/issues/199/comments"},"review_comments":{"href":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199/comments"},"review_comment":{"href":"https://api.github.com/repos/hollowverse/hollowverse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hollowverse/hollowverse/pulls/199/commits"},"statuses":{"href":"https://api.github.com/repos/hollowverse/hollowverse/statuses/6f8a820ee786073f42fc7eea9c6f585f4b9d87c6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"forabi"}}