lbry-desktop/ui/component/claimListDiscover/index.js
infiinte-persistence 2754c962a4 Inf-scroll: Fix glitch when results are exactly the page size.
## Issue
Fixes 2675 `Claim search with exactly 20 results keep fetching next page`

## Changes
Use `claimSearchResultLastPageReached` (I didn't know it existed back then).

The unnecessary "loading" refresh will still happen one time, but at least now it doesn't happen every time we scroll to the bottom (and incorrectly incrementing 'page').
2020-07-14 16:05:42 -04:00

30 lines
1 KiB
JavaScript

import { connect } from 'react-redux';
import {
doClaimSearch,
selectClaimSearchByQuery,
selectClaimSearchByQueryLastPageReached,
selectFetchingClaimSearch,
SETTINGS,
selectFollowedTags,
} from 'lbry-redux';
import { selectBlockedChannels } from 'redux/selectors/blocked';
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import ClaimListDiscover from './view';
const select = state => ({
followedTags: selectFollowedTags(state),
claimSearchByQuery: selectClaimSearchByQuery(state),
claimSearchByQueryLastPageReached: selectClaimSearchByQueryLastPageReached(state),
loading: selectFetchingClaimSearch(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
hiddenUris: selectBlockedChannels(state),
});
const perform = {
doClaimSearch,
doToggleTagFollowDesktop,
};
export default connect(select, perform)(ClaimListDiscover);