Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
MM-13180 Call load posts earlier for infinite scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
sudheerDev committed Nov 26, 2018
1 parent a89ee40 commit b7cd1a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/post_view/post_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ export default class PostList extends React.PureComponent {
// Only count as user scroll if we've already performed our first load scroll
this.hasScrolled = this.hasScrolledToNewMessageSeparator || this.hasScrolledToFocusedPost;
const postList = this.postListRef.current;
const postListScrollTop = postList.scrollTop;

this.updateFloatingTimestamp();

Expand All @@ -452,7 +453,9 @@ export default class PostList extends React.PureComponent {
});
}

if (postList.scrollTop <= 0.5 * postList.clientHeight && !this.state.loadingPosts && !this.state.atEnd && this.state.autoRetryEnable) {
const didScrollPastLoadingPoint = postListScrollTop < 0.3 * (postList.scrollHeight - postList.clientHeight);

if ((didScrollPastLoadingPoint || postListScrollTop < 300) && !this.state.loadingPosts && !this.state.atEnd && this.state.autoRetryEnable) {
this.setState({loadingPosts: true});
this.loadMorePosts();
}
Expand Down

0 comments on commit b7cd1a6

Please sign in to comment.