Skip to content
Snippets Groups Projects
Commit a0880edc authored by Naoki Kosaka's avatar Naoki Kosaka Committed by Eugen Rochko
Browse files

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

parent 61fcdbbf
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ class Followers extends ImmutablePureComponent { ...@@ -27,6 +27,7 @@ class Followers extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
}; };
componentWillMount () { componentWillMount () {
...@@ -44,7 +45,7 @@ class Followers extends ImmutablePureComponent { ...@@ -44,7 +45,7 @@ class Followers extends ImmutablePureComponent {
handleScroll = (e) => { handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target; 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))); this.props.dispatch(expandFollowers(Number(this.props.params.accountId)));
} }
} }
......
...@@ -27,6 +27,7 @@ class Following extends ImmutablePureComponent { ...@@ -27,6 +27,7 @@ class Following extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
}; };
componentWillMount () { componentWillMount () {
...@@ -44,7 +45,7 @@ class Following extends ImmutablePureComponent { ...@@ -44,7 +45,7 @@ class Following extends ImmutablePureComponent {
handleScroll = (e) => { handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target; 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))); this.props.dispatch(expandFollowing(Number(this.props.params.accountId)));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment