{"action":"created","comment":{"url":"https://api.github.com/repos/smooch/smooch-js/pulls/comments/76131825","id":76131825,"diff_hunk":"@@ -54,34 +66,146 @@ export class ConversationComponent extends Component {\n \n     };\n \n+    onScroll = () => {\n+        const {dispatch, shouldScrollToBottom} = this.props;\n+\n+        // If top of Conversation component is reached, we need to fetch older messages\n+        const node = findDOMNode(this);\n+        if (node.scrollTop === 0) {\n+            this.fetchHistory();\n+        } else if (shouldScrollToBottom) {\n+            // Once we've started scrolling, we don't want the default behavior to force the scroll to the bottom afterwards\n+            dispatch(setShouldScrollToBottom(false));\n+        }\n+    };\n+\n+    fetchHistory = () => {\n+        const {dispatch, hasMoreMessages, isFetchingMoreMessages, messages} = this.props;\n+\n+        const node = findDOMNode(this);\n+        if (hasMoreMessages && !isFetchingMoreMessages) {","path":"src/js/components/conversation.jsx","position":53,"original_position":53,"commit_id":"b2af87a79eb0e56c4cf0551098d7a76190c06704","original_commit_id":"b2af87a79eb0e56c4cf0551098d7a76190c06704","user":{"login":"alavers","id":2432382,"avatar_url":"https://avatars.githubusercontent.com/u/2432382?v=3","gravatar_id":"","url":"https://api.github.com/users/alavers","html_url":"https://github.com/alavers","followers_url":"https://api.github.com/users/alavers/followers","following_url":"https://api.github.com/users/alavers/following{/other_user}","gists_url":"https://api.github.com/users/alavers/gists{/gist_id}","starred_url":"https://api.github.com/users/alavers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alavers/subscriptions","organizations_url":"https://api.github.com/users/alavers/orgs","repos_url":"https://api.github.com/users/alavers/repos","events_url":"https://api.github.com/users/alavers/events{/privacy}","received_events_url":"https://api.github.com/users/alavers/received_events","type":"User","site_admin":false},"body":"Oh, yeah for sure, I'm only suggesting that the `if (hasMoreMessages && !isFetchingMoreMessages) {` statement so that it wraps the call `onScroll` makes to fetchHistory instead of doing it inside fetchHistory itself.\r\n\r\nAlso, the `const node = findDOMNode(this);` call you make isn't necessary if the if statement is false :)","created_at":"2016-08-24T20:24:17Z","updated_at":"2016-08-24T20:24:17Z","html_url":"https://github.com/smooch/smooch-js/pull/378#discussion_r76131825","pull_request_url":"https://api.github.com/repos/smooch/smooch-js/pulls/378","_links":{"self":{"href":"https://api.github.com/repos/smooch/smooch-js/pulls/comments/76131825"},"html":{"href":"https://github.com/smooch/smooch-js/pull/378#discussion_r76131825"},"pull_request":{"href":"https://api.github.com/repos/smooch/smooch-js/pulls/378"}}},"pull_request":{"url":"https://api.github.com/repos/smooch/smooch-js/pulls/378","id":82244396,"html_url":"https://github.com/smooch/smooch-js/pull/378","diff_url":"https://github.com/smooch/smooch-js/pull/378.diff","patch_url":"https://github.com/smooch/smooch-js/pull/378.patch","issue_url":"https://api.github.com/repos/smooch/smooch-js/issues/378","number":378,"state":"open","locked":false,"title":"Add pagination in web widget","user":{"login":"chloepouprom","id":4314491,"avatar_url":"https://avatars.githubusercontent.com/u/4314491?v=3","gravatar_id":"","url":"https://api.github.com/users/chloepouprom","html_url":"https://github.com/chloepouprom","followers_url":"https://api.github.com/users/chloepouprom/followers","following_url":"https://api.github.com/users/chloepouprom/following{/other_user}","gists_url":"https://api.github.com/users/chloepouprom/gists{/gist_id}","starred_url":"https://api.github.com/users/chloepouprom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chloepouprom/subscriptions","organizations_url":"https://api.github.com/users/chloepouprom/orgs","repos_url":"https://api.github.com/users/chloepouprom/repos","events_url":"https://api.github.com/users/chloepouprom/events{/privacy}","received_events_url":"https://api.github.com/users/chloepouprom/received_events","type":"User","site_admin":false},"body":"I closed the previous pull request https://github.com/smooch/smooch-js/pull/374 since this would have otherwise gotten confusing with all the comments.\r\n\r\nAnyway, this pretty much does the same as the previous PR except that now the Introduction component is only present at the very beginning of the conversation.\r\n\r\n![pagination_intro](https://cloud.githubusercontent.com/assets/4314491/17867562/fd1d427a-6878-11e6-974a-bea807a32354.gif)\r\n\r\n@lemieux @alavers @mspensieri ","created_at":"2016-08-22T19:00:33Z","updated_at":"2016-08-24T20:24:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"167039135e409b21a049271e854895471682866b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/smooch/smooch-js/pulls/378/commits","review_comments_url":"https://api.github.com/repos/smooch/smooch-js/pulls/378/comments","review_comment_url":"https://api.github.com/repos/smooch/smooch-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/smooch/smooch-js/issues/378/comments","statuses_url":"https://api.github.com/repos/smooch/smooch-js/statuses/b2af87a79eb0e56c4cf0551098d7a76190c06704","head":{"label":"smooch:f/pagination","ref":"f/pagination","sha":"b2af87a79eb0e56c4cf0551098d7a76190c06704","user":{"login":"smooch","id":14301989,"avatar_url":"https://avatars.githubusercontent.com/u/14301989?v=3","gravatar_id":"","url":"https://api.github.com/users/smooch","html_url":"https://github.com/smooch","followers_url":"https://api.github.com/users/smooch/followers","following_url":"https://api.github.com/users/smooch/following{/other_user}","gists_url":"https://api.github.com/users/smooch/gists{/gist_id}","starred_url":"https://api.github.com/users/smooch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smooch/subscriptions","organizations_url":"https://api.github.com/users/smooch/orgs","repos_url":"https://api.github.com/users/smooch/repos","events_url":"https://api.github.com/users/smooch/events{/privacy}","received_events_url":"https://api.github.com/users/smooch/received_events","type":"Organization","site_admin":false},"repo":{"id":36675403,"name":"smooch-js","full_name":"smooch/smooch-js","owner":{"login":"smooch","id":14301989,"avatar_url":"https://avatars.githubusercontent.com/u/14301989?v=3","gravatar_id":"","url":"https://api.github.com/users/smooch","html_url":"https://github.com/smooch","followers_url":"https://api.github.com/users/smooch/followers","following_url":"https://api.github.com/users/smooch/following{/other_user}","gists_url":"https://api.github.com/users/smooch/gists{/gist_id}","starred_url":"https://api.github.com/users/smooch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smooch/subscriptions","organizations_url":"https://api.github.com/users/smooch/orgs","repos_url":"https://api.github.com/users/smooch/repos","events_url":"https://api.github.com/users/smooch/events{/privacy}","received_events_url":"https://api.github.com/users/smooch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smooch/smooch-js","description":"The Smooch Javascript SDK will add live web messaging to your website or web app.","fork":false,"url":"https://api.github.com/repos/smooch/smooch-js","forks_url":"https://api.github.com/repos/smooch/smooch-js/forks","keys_url":"https://api.github.com/repos/smooch/smooch-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smooch/smooch-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smooch/smooch-js/teams","hooks_url":"https://api.github.com/repos/smooch/smooch-js/hooks","issue_events_url":"https://api.github.com/repos/smooch/smooch-js/issues/events{/number}","events_url":"https://api.github.com/repos/smooch/smooch-js/events","assignees_url":"https://api.github.com/repos/smooch/smooch-js/assignees{/user}","branches_url":"https://api.github.com/repos/smooch/smooch-js/branches{/branch}","tags_url":"https://api.github.com/repos/smooch/smooch-js/tags","blobs_url":"https://api.github.com/repos/smooch/smooch-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smooch/smooch-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smooch/smooch-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/smooch/smooch-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smooch/smooch-js/statuses/{sha}","languages_url":"https://api.github.com/repos/smooch/smooch-js/languages","stargazers_url":"https://api.github.com/repos/smooch/smooch-js/stargazers","contributors_url":"https://api.github.com/repos/smooch/smooch-js/contributors","subscribers_url":"https://api.github.com/repos/smooch/smooch-js/subscribers","subscription_url":"https://api.github.com/repos/smooch/smooch-js/subscription","commits_url":"https://api.github.com/repos/smooch/smooch-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/smooch/smooch-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/smooch/smooch-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/smooch/smooch-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/smooch/smooch-js/contents/{+path}","compare_url":"https://api.github.com/repos/smooch/smooch-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smooch/smooch-js/merges","archive_url":"https://api.github.com/repos/smooch/smooch-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smooch/smooch-js/downloads","issues_url":"https://api.github.com/repos/smooch/smooch-js/issues{/number}","pulls_url":"https://api.github.com/repos/smooch/smooch-js/pulls{/number}","milestones_url":"https://api.github.com/repos/smooch/smooch-js/milestones{/number}","notifications_url":"https://api.github.com/repos/smooch/smooch-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smooch/smooch-js/labels{/name}","releases_url":"https://api.github.com/repos/smooch/smooch-js/releases{/id}","deployments_url":"https://api.github.com/repos/smooch/smooch-js/deployments","created_at":"2015-06-01T17:03:32Z","updated_at":"2016-08-24T02:11:45Z","pushed_at":"2016-08-24T17:49:15Z","git_url":"git://github.com/smooch/smooch-js.git","ssh_url":"git@github.com:smooch/smooch-js.git","clone_url":"https://github.com/smooch/smooch-js.git","svn_url":"https://github.com/smooch/smooch-js","homepage":"https://smooch.io/live-web-chat","size":14179,"stargazers_count":83,"watchers_count":83,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":8,"forks":36,"open_issues":8,"watchers":83,"default_branch":"integration"}},"base":{"label":"smooch:f/appusers-messages-endpoint","ref":"f/appusers-messages-endpoint","sha":"80fbab89a37ad9246afcb219f3882323c509432a","user":{"login":"smooch","id":14301989,"avatar_url":"https://avatars.githubusercontent.com/u/14301989?v=3","gravatar_id":"","url":"https://api.github.com/users/smooch","html_url":"https://github.com/smooch","followers_url":"https://api.github.com/users/smooch/followers","following_url":"https://api.github.com/users/smooch/following{/other_user}","gists_url":"https://api.github.com/users/smooch/gists{/gist_id}","starred_url":"https://api.github.com/users/smooch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smooch/subscriptions","organizations_url":"https://api.github.com/users/smooch/orgs","repos_url":"https://api.github.com/users/smooch/repos","events_url":"https://api.github.com/users/smooch/events{/privacy}","received_events_url":"https://api.github.com/users/smooch/received_events","type":"Organization","site_admin":false},"repo":{"id":36675403,"name":"smooch-js","full_name":"smooch/smooch-js","owner":{"login":"smooch","id":14301989,"avatar_url":"https://avatars.githubusercontent.com/u/14301989?v=3","gravatar_id":"","url":"https://api.github.com/users/smooch","html_url":"https://github.com/smooch","followers_url":"https://api.github.com/users/smooch/followers","following_url":"https://api.github.com/users/smooch/following{/other_user}","gists_url":"https://api.github.com/users/smooch/gists{/gist_id}","starred_url":"https://api.github.com/users/smooch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smooch/subscriptions","organizations_url":"https://api.github.com/users/smooch/orgs","repos_url":"https://api.github.com/users/smooch/repos","events_url":"https://api.github.com/users/smooch/events{/privacy}","received_events_url":"https://api.github.com/users/smooch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smooch/smooch-js","description":"The Smooch Javascript SDK will add live web messaging to your website or web app.","fork":false,"url":"https://api.github.com/repos/smooch/smooch-js","forks_url":"https://api.github.com/repos/smooch/smooch-js/forks","keys_url":"https://api.github.com/repos/smooch/smooch-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smooch/smooch-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smooch/smooch-js/teams","hooks_url":"https://api.github.com/repos/smooch/smooch-js/hooks","issue_events_url":"https://api.github.com/repos/smooch/smooch-js/issues/events{/number}","events_url":"https://api.github.com/repos/smooch/smooch-js/events","assignees_url":"https://api.github.com/repos/smooch/smooch-js/assignees{/user}","branches_url":"https://api.github.com/repos/smooch/smooch-js/branches{/branch}","tags_url":"https://api.github.com/repos/smooch/smooch-js/tags","blobs_url":"https://api.github.com/repos/smooch/smooch-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smooch/smooch-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smooch/smooch-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/smooch/smooch-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smooch/smooch-js/statuses/{sha}","languages_url":"https://api.github.com/repos/smooch/smooch-js/languages","stargazers_url":"https://api.github.com/repos/smooch/smooch-js/stargazers","contributors_url":"https://api.github.com/repos/smooch/smooch-js/contributors","subscribers_url":"https://api.github.com/repos/smooch/smooch-js/subscribers","subscription_url":"https://api.github.com/repos/smooch/smooch-js/subscription","commits_url":"https://api.github.com/repos/smooch/smooch-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/smooch/smooch-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/smooch/smooch-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/smooch/smooch-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/smooch/smooch-js/contents/{+path}","compare_url":"https://api.github.com/repos/smooch/smooch-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smooch/smooch-js/merges","archive_url":"https://api.github.com/repos/smooch/smooch-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smooch/smooch-js/downloads","issues_url":"https://api.github.com/repos/smooch/smooch-js/issues{/number}","pulls_url":"https://api.github.com/repos/smooch/smooch-js/pulls{/number}","milestones_url":"https://api.github.com/repos/smooch/smooch-js/milestones{/number}","notifications_url":"https://api.github.com/repos/smooch/smooch-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smooch/smooch-js/labels{/name}","releases_url":"https://api.github.com/repos/smooch/smooch-js/releases{/id}","deployments_url":"https://api.github.com/repos/smooch/smooch-js/deployments","created_at":"2015-06-01T17:03:32Z","updated_at":"2016-08-24T02:11:45Z","pushed_at":"2016-08-24T17:49:15Z","git_url":"git://github.com/smooch/smooch-js.git","ssh_url":"git@github.com:smooch/smooch-js.git","clone_url":"https://github.com/smooch/smooch-js.git","svn_url":"https://github.com/smooch/smooch-js","homepage":"https://smooch.io/live-web-chat","size":14179,"stargazers_count":83,"watchers_count":83,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":8,"forks":36,"open_issues":8,"watchers":83,"default_branch":"integration"}},"_links":{"self":{"href":"https://api.github.com/repos/smooch/smooch-js/pulls/378"},"html":{"href":"https://github.com/smooch/smooch-js/pull/378"},"issue":{"href":"https://api.github.com/repos/smooch/smooch-js/issues/378"},"comments":{"href":"https://api.github.com/repos/smooch/smooch-js/issues/378/comments"},"review_comments":{"href":"https://api.github.com/repos/smooch/smooch-js/pulls/378/comments"},"review_comment":{"href":"https://api.github.com/repos/smooch/smooch-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/smooch/smooch-js/pulls/378/commits"},"statuses":{"href":"https://api.github.com/repos/smooch/smooch-js/statuses/b2af87a79eb0e56c4cf0551098d7a76190c06704"}}}}
{"actor":{"display_login":"alavers"}}