{"action":"created","comment":{"url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/comments/165404391","pull_request_review_id":93331309,"id":165404391,"diff_hunk":"@@ -273,18 +345,44 @@ export class ChatApp extends React.Component<\n \n     public async componentDidMount() {\n         this.chatClient = await Chat.create(this.props.token);\n-        this.chatClient.on(\"channelAdded\", (channel: any) => {\n-            this.setState((prevState, props) => ({\n-                channels: [...prevState.channels, channel.uniqueName],\n-            }));\n+\n+        this.updateChannels();\n+        // I have a problem here when I create a new channel, rendering is done before\n+        // this.state.channels is filled, so i've got an error, i'll correct it asap\n+        this.chatClient.on(\"channelAdded\", async (newChannel) => {\n+            if (this.chatClient !== undefined) {\n+                const channels = await this.chatClient.getSubscribedChannels(\n+                    undefined,\n+                );\n+                this.state.channels.map(async (channel) => {","path":"components/ChatApp.tsx","position":207,"original_position":207,"commit_id":"3bc11b0e3bfdf7e7851fa0bc5d2f90337d5c07ef","original_commit_id":"3bc11b0e3bfdf7e7851fa0bc5d2f90337d5c07ef","user":{"login":"brikou","id":383212,"avatar_url":"https://avatars3.githubusercontent.com/u/383212?v=4","gravatar_id":"","url":"https://api.github.com/users/brikou","html_url":"https://github.com/brikou","followers_url":"https://api.github.com/users/brikou/followers","following_url":"https://api.github.com/users/brikou/following{/other_user}","gists_url":"https://api.github.com/users/brikou/gists{/gist_id}","starred_url":"https://api.github.com/users/brikou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brikou/subscriptions","organizations_url":"https://api.github.com/users/brikou/orgs","repos_url":"https://api.github.com/users/brikou/repos","events_url":"https://api.github.com/users/brikou/events{/privacy}","received_events_url":"https://api.github.com/users/brikou/received_events","type":"User","site_admin":false},"body":"use a reduce function instead","created_at":"2018-02-01T16:10:37Z","updated_at":"2018-02-01T16:12:06Z","html_url":"https://github.com/lcordier42/typescript_twilio/pull/21#discussion_r165404391","pull_request_url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/comments/165404391"},"html":{"href":"https://github.com/lcordier42/typescript_twilio/pull/21#discussion_r165404391"},"pull_request":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21","id":166316461,"html_url":"https://github.com/lcordier42/typescript_twilio/pull/21","diff_url":"https://github.com/lcordier42/typescript_twilio/pull/21.diff","patch_url":"https://github.com/lcordier42/typescript_twilio/pull/21.patch","issue_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/21","number":21,"state":"open","locked":false,"title":"[WIP] Add print of last message send under each channel","user":{"login":"lcordier42","id":23701961,"avatar_url":"https://avatars3.githubusercontent.com/u/23701961?v=4","gravatar_id":"","url":"https://api.github.com/users/lcordier42","html_url":"https://github.com/lcordier42","followers_url":"https://api.github.com/users/lcordier42/followers","following_url":"https://api.github.com/users/lcordier42/following{/other_user}","gists_url":"https://api.github.com/users/lcordier42/gists{/gist_id}","starred_url":"https://api.github.com/users/lcordier42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcordier42/subscriptions","organizations_url":"https://api.github.com/users/lcordier42/orgs","repos_url":"https://api.github.com/users/lcordier42/repos","events_url":"https://api.github.com/users/lcordier42/events{/privacy}","received_events_url":"https://api.github.com/users/lcordier42/received_events","type":"User","site_admin":false},"body":"I have two things to correct:\r\n    - stay on the channel i'm when i refresh the page, do you have a suggest to do it? Put in the query the id of the member I want to talk when i click on a chan? Before I used sessionStorage, but probably not a good idea.\r\n    - correct the error when I create a channel for the first time","created_at":"2018-01-31T16:52:22Z","updated_at":"2018-02-01T16:12:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76c803e41362ac216441227f4d5841ccd65f8348","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21/commits","review_comments_url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21/comments","review_comment_url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/21/comments","statuses_url":"https://api.github.com/repos/lcordier42/typescript_twilio/statuses/3bc11b0e3bfdf7e7851fa0bc5d2f90337d5c07ef","head":{"label":"lcordier42:feature/display_last_message","ref":"feature/display_last_message","sha":"3bc11b0e3bfdf7e7851fa0bc5d2f90337d5c07ef","user":{"login":"lcordier42","id":23701961,"avatar_url":"https://avatars3.githubusercontent.com/u/23701961?v=4","gravatar_id":"","url":"https://api.github.com/users/lcordier42","html_url":"https://github.com/lcordier42","followers_url":"https://api.github.com/users/lcordier42/followers","following_url":"https://api.github.com/users/lcordier42/following{/other_user}","gists_url":"https://api.github.com/users/lcordier42/gists{/gist_id}","starred_url":"https://api.github.com/users/lcordier42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcordier42/subscriptions","organizations_url":"https://api.github.com/users/lcordier42/orgs","repos_url":"https://api.github.com/users/lcordier42/repos","events_url":"https://api.github.com/users/lcordier42/events{/privacy}","received_events_url":"https://api.github.com/users/lcordier42/received_events","type":"User","site_admin":false},"repo":{"id":117698566,"name":"typescript_twilio","full_name":"lcordier42/typescript_twilio","owner":{"login":"lcordier42","id":23701961,"avatar_url":"https://avatars3.githubusercontent.com/u/23701961?v=4","gravatar_id":"","url":"https://api.github.com/users/lcordier42","html_url":"https://github.com/lcordier42","followers_url":"https://api.github.com/users/lcordier42/followers","following_url":"https://api.github.com/users/lcordier42/following{/other_user}","gists_url":"https://api.github.com/users/lcordier42/gists{/gist_id}","starred_url":"https://api.github.com/users/lcordier42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcordier42/subscriptions","organizations_url":"https://api.github.com/users/lcordier42/orgs","repos_url":"https://api.github.com/users/lcordier42/repos","events_url":"https://api.github.com/users/lcordier42/events{/privacy}","received_events_url":"https://api.github.com/users/lcordier42/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lcordier42/typescript_twilio","description":null,"fork":false,"url":"https://api.github.com/repos/lcordier42/typescript_twilio","forks_url":"https://api.github.com/repos/lcordier42/typescript_twilio/forks","keys_url":"https://api.github.com/repos/lcordier42/typescript_twilio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lcordier42/typescript_twilio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lcordier42/typescript_twilio/teams","hooks_url":"https://api.github.com/repos/lcordier42/typescript_twilio/hooks","issue_events_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/events{/number}","events_url":"https://api.github.com/repos/lcordier42/typescript_twilio/events","assignees_url":"https://api.github.com/repos/lcordier42/typescript_twilio/assignees{/user}","branches_url":"https://api.github.com/repos/lcordier42/typescript_twilio/branches{/branch}","tags_url":"https://api.github.com/repos/lcordier42/typescript_twilio/tags","blobs_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/refs{/sha}","trees_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lcordier42/typescript_twilio/statuses/{sha}","languages_url":"https://api.github.com/repos/lcordier42/typescript_twilio/languages","stargazers_url":"https://api.github.com/repos/lcordier42/typescript_twilio/stargazers","contributors_url":"https://api.github.com/repos/lcordier42/typescript_twilio/contributors","subscribers_url":"https://api.github.com/repos/lcordier42/typescript_twilio/subscribers","subscription_url":"https://api.github.com/repos/lcordier42/typescript_twilio/subscription","commits_url":"https://api.github.com/repos/lcordier42/typescript_twilio/commits{/sha}","git_commits_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/commits{/sha}","comments_url":"https://api.github.com/repos/lcordier42/typescript_twilio/comments{/number}","issue_comment_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/comments{/number}","contents_url":"https://api.github.com/repos/lcordier42/typescript_twilio/contents/{+path}","compare_url":"https://api.github.com/repos/lcordier42/typescript_twilio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lcordier42/typescript_twilio/merges","archive_url":"https://api.github.com/repos/lcordier42/typescript_twilio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lcordier42/typescript_twilio/downloads","issues_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues{/number}","pulls_url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls{/number}","milestones_url":"https://api.github.com/repos/lcordier42/typescript_twilio/milestones{/number}","notifications_url":"https://api.github.com/repos/lcordier42/typescript_twilio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lcordier42/typescript_twilio/labels{/name}","releases_url":"https://api.github.com/repos/lcordier42/typescript_twilio/releases{/id}","deployments_url":"https://api.github.com/repos/lcordier42/typescript_twilio/deployments","created_at":"2018-01-16T15:03:51Z","updated_at":"2018-01-17T13:59:00Z","pushed_at":"2018-02-01T13:56:48Z","git_url":"git://github.com/lcordier42/typescript_twilio.git","ssh_url":"git@github.com:lcordier42/typescript_twilio.git","clone_url":"https://github.com/lcordier42/typescript_twilio.git","svn_url":"https://github.com/lcordier42/typescript_twilio","homepage":null,"size":242,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"lcordier42:master","ref":"master","sha":"0ec96e804cd59274dd5e6ca8d00c593eeab27cc3","user":{"login":"lcordier42","id":23701961,"avatar_url":"https://avatars3.githubusercontent.com/u/23701961?v=4","gravatar_id":"","url":"https://api.github.com/users/lcordier42","html_url":"https://github.com/lcordier42","followers_url":"https://api.github.com/users/lcordier42/followers","following_url":"https://api.github.com/users/lcordier42/following{/other_user}","gists_url":"https://api.github.com/users/lcordier42/gists{/gist_id}","starred_url":"https://api.github.com/users/lcordier42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcordier42/subscriptions","organizations_url":"https://api.github.com/users/lcordier42/orgs","repos_url":"https://api.github.com/users/lcordier42/repos","events_url":"https://api.github.com/users/lcordier42/events{/privacy}","received_events_url":"https://api.github.com/users/lcordier42/received_events","type":"User","site_admin":false},"repo":{"id":117698566,"name":"typescript_twilio","full_name":"lcordier42/typescript_twilio","owner":{"login":"lcordier42","id":23701961,"avatar_url":"https://avatars3.githubusercontent.com/u/23701961?v=4","gravatar_id":"","url":"https://api.github.com/users/lcordier42","html_url":"https://github.com/lcordier42","followers_url":"https://api.github.com/users/lcordier42/followers","following_url":"https://api.github.com/users/lcordier42/following{/other_user}","gists_url":"https://api.github.com/users/lcordier42/gists{/gist_id}","starred_url":"https://api.github.com/users/lcordier42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcordier42/subscriptions","organizations_url":"https://api.github.com/users/lcordier42/orgs","repos_url":"https://api.github.com/users/lcordier42/repos","events_url":"https://api.github.com/users/lcordier42/events{/privacy}","received_events_url":"https://api.github.com/users/lcordier42/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lcordier42/typescript_twilio","description":null,"fork":false,"url":"https://api.github.com/repos/lcordier42/typescript_twilio","forks_url":"https://api.github.com/repos/lcordier42/typescript_twilio/forks","keys_url":"https://api.github.com/repos/lcordier42/typescript_twilio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lcordier42/typescript_twilio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lcordier42/typescript_twilio/teams","hooks_url":"https://api.github.com/repos/lcordier42/typescript_twilio/hooks","issue_events_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/events{/number}","events_url":"https://api.github.com/repos/lcordier42/typescript_twilio/events","assignees_url":"https://api.github.com/repos/lcordier42/typescript_twilio/assignees{/user}","branches_url":"https://api.github.com/repos/lcordier42/typescript_twilio/branches{/branch}","tags_url":"https://api.github.com/repos/lcordier42/typescript_twilio/tags","blobs_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/refs{/sha}","trees_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lcordier42/typescript_twilio/statuses/{sha}","languages_url":"https://api.github.com/repos/lcordier42/typescript_twilio/languages","stargazers_url":"https://api.github.com/repos/lcordier42/typescript_twilio/stargazers","contributors_url":"https://api.github.com/repos/lcordier42/typescript_twilio/contributors","subscribers_url":"https://api.github.com/repos/lcordier42/typescript_twilio/subscribers","subscription_url":"https://api.github.com/repos/lcordier42/typescript_twilio/subscription","commits_url":"https://api.github.com/repos/lcordier42/typescript_twilio/commits{/sha}","git_commits_url":"https://api.github.com/repos/lcordier42/typescript_twilio/git/commits{/sha}","comments_url":"https://api.github.com/repos/lcordier42/typescript_twilio/comments{/number}","issue_comment_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/comments{/number}","contents_url":"https://api.github.com/repos/lcordier42/typescript_twilio/contents/{+path}","compare_url":"https://api.github.com/repos/lcordier42/typescript_twilio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lcordier42/typescript_twilio/merges","archive_url":"https://api.github.com/repos/lcordier42/typescript_twilio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lcordier42/typescript_twilio/downloads","issues_url":"https://api.github.com/repos/lcordier42/typescript_twilio/issues{/number}","pulls_url":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls{/number}","milestones_url":"https://api.github.com/repos/lcordier42/typescript_twilio/milestones{/number}","notifications_url":"https://api.github.com/repos/lcordier42/typescript_twilio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lcordier42/typescript_twilio/labels{/name}","releases_url":"https://api.github.com/repos/lcordier42/typescript_twilio/releases{/id}","deployments_url":"https://api.github.com/repos/lcordier42/typescript_twilio/deployments","created_at":"2018-01-16T15:03:51Z","updated_at":"2018-01-17T13:59:00Z","pushed_at":"2018-02-01T13:56:48Z","git_url":"git://github.com/lcordier42/typescript_twilio.git","ssh_url":"git@github.com:lcordier42/typescript_twilio.git","clone_url":"https://github.com/lcordier42/typescript_twilio.git","svn_url":"https://github.com/lcordier42/typescript_twilio","homepage":null,"size":242,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21"},"html":{"href":"https://github.com/lcordier42/typescript_twilio/pull/21"},"issue":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/21"},"comments":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/lcordier42/typescript_twilio/statuses/3bc11b0e3bfdf7e7851fa0bc5d2f90337d5c07ef"}},"author_association":"OWNER"}}
{"actor":{"display_login":"brikou"}}