Browse Source

Fix (PR #3585) Add hasMore to propTypes and cover handleScroll. (#3589)

master
Naoki Kosaka 7 years ago
committed by Eugen Rochko
parent
commit
a0880edc6e
2 changed files with 4 additions and 2 deletions
  1. +2
    -1
      app/javascript/mastodon/features/followers/index.js
  2. +2
    -1
      app/javascript/mastodon/features/following/index.js

+ 2
- 1
app/javascript/mastodon/features/followers/index.js View 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)));
}
}

+ 2
- 1
app/javascript/mastodon/features/following/index.js View 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)));
}
}

Loading…
Cancel
Save