forked from fedi/mastodon
Fix LoadMore in following and followers. (#3585)
This commit is contained in:
parent
4c06d1cb24
commit
1f1d6bf2a0
|
@ -18,6 +18,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']),
|
accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']),
|
||||||
|
hasMore: !!state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'next']),
|
||||||
});
|
});
|
||||||
|
|
||||||
class Followers extends ImmutablePureComponent {
|
class Followers extends ImmutablePureComponent {
|
||||||
|
@ -54,7 +55,9 @@ class Followers extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { accountIds } = this.props;
|
const { accountIds, hasMore } = this.props;
|
||||||
|
|
||||||
|
let loadMore = null;
|
||||||
|
|
||||||
if (!accountIds) {
|
if (!accountIds) {
|
||||||
return (
|
return (
|
||||||
|
@ -64,6 +67,10 @@ class Followers extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasMore) {
|
||||||
|
loadMore = <LoadMore onClick={this.handleLoadMore} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column>
|
<Column>
|
||||||
<ColumnBackButton />
|
<ColumnBackButton />
|
||||||
|
@ -73,7 +80,7 @@ class Followers extends ImmutablePureComponent {
|
||||||
<div className='followers'>
|
<div className='followers'>
|
||||||
<HeaderContainer accountId={this.props.params.accountId} />
|
<HeaderContainer accountId={this.props.params.accountId} />
|
||||||
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
|
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
|
||||||
<LoadMore onClick={this.handleLoadMore} />
|
{loadMore}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
|
|
|
@ -18,6 +18,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items']),
|
accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items']),
|
||||||
|
hasMore: !!state.getIn(['user_lists', 'following', Number(props.params.accountId), 'next']),
|
||||||
});
|
});
|
||||||
|
|
||||||
class Following extends ImmutablePureComponent {
|
class Following extends ImmutablePureComponent {
|
||||||
|
@ -54,7 +55,9 @@ class Following extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { accountIds } = this.props;
|
const { accountIds, hasMore } = this.props;
|
||||||
|
|
||||||
|
let loadMore = null;
|
||||||
|
|
||||||
if (!accountIds) {
|
if (!accountIds) {
|
||||||
return (
|
return (
|
||||||
|
@ -64,6 +67,10 @@ class Following extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasMore) {
|
||||||
|
loadMore = <LoadMore onClick={this.handleLoadMore} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column>
|
<Column>
|
||||||
<ColumnBackButton />
|
<ColumnBackButton />
|
||||||
|
@ -73,7 +80,7 @@ class Following extends ImmutablePureComponent {
|
||||||
<div className='following'>
|
<div className='following'>
|
||||||
<HeaderContainer accountId={this.props.params.accountId} />
|
<HeaderContainer accountId={this.props.params.accountId} />
|
||||||
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
|
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
|
||||||
<LoadMore onClick={this.handleLoadMore} />
|
{loadMore}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
|
|
Loading…
Reference in a new issue