Skip to content

Commit

Permalink
fix(react): use hasMore for infinite scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
samouss committed Jul 13, 2018
1 parent 548db48 commit 16aac1d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions React InstantSearch/infinite-scroll/src/InfiniteHits.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import Hit from './Hit';
class InfiniteHits extends Component {
static propTypes = {
hits: PropTypes.arrayOf(PropTypes.object).isRequired,
minHitsPerPage: PropTypes.number.isRequired,
hasMore: PropTypes.bool.isRequired,
refine: PropTypes.func.isRequired,
};

sentinel = null;

onReachThreshold = entries => {
const { hits, minHitsPerPage, refine } = this.props;
const { hasMore, refine } = this.props;

entries.forEach(entry => {
if (entry.isIntersecting && hits.length >= minHitsPerPage) {
if (entry.isIntersecting && hasMore) {
refine();
}
});
Expand Down

0 comments on commit 16aac1d

Please sign in to comment.