]> cat aescling's git repositories - mastodon.git/commitdiff
Fix (PR #3585) Add hasMore to propTypes and cover handleScroll. (#3589)
authorNaoki Kosaka <n.k@mail.yukimochi.net>
Mon, 5 Jun 2017 16:18:56 +0000 (01:18 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 5 Jun 2017 16:18:56 +0000 (18:18 +0200)
app/javascript/mastodon/features/followers/index.js
app/javascript/mastodon/features/following/index.js

index 5120a5747e2cc02e7a11a34b6f74d5bf55c2c311..e9910dce48d8b4f3f8c024d0221fbd5a5d896345 100644 (file)
@@ -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)));
     }
   }
index e7be0f084be6dcae7a994a7d0873d146e531b475..764f702fff9cc46f0cebbb8d3a69cbcd9c7d39a8 100644 (file)
@@ -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)));
     }
   }