fix(core): load more entries until viewport is filled (#2415)
This commit is contained in:
parent
0faf2ec8ab
commit
a02496b0dd
@ -25,10 +25,13 @@ export default class EntryListing extends React.Component {
|
|||||||
handleCursorActions: PropTypes.func.isRequired,
|
handleCursorActions: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hasMore = () => {
|
||||||
|
return Cursor.create(this.props.cursor).actions.has('append_next');
|
||||||
|
};
|
||||||
|
|
||||||
handleLoadMore = () => {
|
handleLoadMore = () => {
|
||||||
const { cursor, handleCursorActions } = this.props;
|
if (this.hasMore()) {
|
||||||
if (Cursor.create(cursor).actions.has('append_next')) {
|
this.props.handleCursorActions('append_next');
|
||||||
handleCursorActions('append_next');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,7 +74,7 @@ export default class EntryListing extends React.Component {
|
|||||||
{Map.isMap(collections)
|
{Map.isMap(collections)
|
||||||
? this.renderCardsForSingleCollection()
|
? this.renderCardsForSingleCollection()
|
||||||
: this.renderCardsForMultipleCollections()}
|
: this.renderCardsForMultipleCollections()}
|
||||||
<Waypoint onEnter={this.handleLoadMore} />
|
{this.hasMore() && <Waypoint onEnter={this.handleLoadMore} />}
|
||||||
</CardsGrid>
|
</CardsGrid>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user