From a0880edc6e95b4fa43039e3bfbe31ea078cef2e8 Mon Sep 17 00:00:00 2001 From: Naoki Kosaka Date: Tue, 6 Jun 2017 01:18:56 +0900 Subject: [PATCH] Fix (PR #3585) Add hasMore to propTypes and cover handleScroll. (#3589) --- app/javascript/mastodon/features/followers/index.js | 3 ++- app/javascript/mastodon/features/following/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/mastodon/features/followers/index.js index 5120a5747..e9910dce4 100644 --- a/app/javascript/mastodon/features/followers/index.js +++ b/app/javascript/mastodon/features/followers/index.js @@ -27,6 +27,7 @@ class Followers extends ImmutablePureComponent { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, + hasMore: PropTypes.bool, }; componentWillMount () { @@ -44,7 +45,7 @@ class Followers extends ImmutablePureComponent { handleScroll = (e) => { const { scrollTop, scrollHeight, clientHeight } = e.target; - if (scrollTop === scrollHeight - clientHeight) { + if (scrollTop === scrollHeight - clientHeight && this.props.hasMore) { this.props.dispatch(expandFollowers(Number(this.props.params.accountId))); } } diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/mastodon/features/following/index.js index e7be0f084..764f702ff 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/mastodon/features/following/index.js @@ -27,6 +27,7 @@ class Following extends ImmutablePureComponent { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, + hasMore: PropTypes.bool, }; componentWillMount () { @@ -44,7 +45,7 @@ class Following extends ImmutablePureComponent { handleScroll = (e) => { const { scrollTop, scrollHeight, clientHeight } = e.target; - if (scrollTop === scrollHeight - clientHeight) { + if (scrollTop === scrollHeight - clientHeight && this.props.hasMore) { this.props.dispatch(expandFollowing(Number(this.props.params.accountId))); } }