diff --git a/src/ui/component/channelContent/index.js b/src/ui/component/channelContent/index.js index 89bf3f118..e8305494f 100644 --- a/src/ui/component/channelContent/index.js +++ b/src/ui/component/channelContent/index.js @@ -2,25 +2,34 @@ import { connect } from 'react-redux'; import { doFetchClaimsByChannel } from 'redux/actions/content'; import { PAGE_SIZE } from 'constants/claim'; import { - makeSelectClaimsInChannelForCurrentPageState, + makeSelectClaimsInChannelForPage, makeSelectFetchingChannelClaims, makeSelectClaimIsMine, makeSelectTotalPagesForChannel, } from 'lbry-redux'; +import { withRouter } from 'react-router'; import ChannelPage from './view'; -const select = (state, props) => ({ - claimsInChannel: makeSelectClaimsInChannelForCurrentPageState(props.uri)(state), - fetching: makeSelectFetchingChannelClaims(props.uri)(state), - totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state), - channelIsMine: makeSelectClaimIsMine(props.uri)(state), -}); +const select = (state, props) => { + console.log('props', props); + const { search } = props.location; + const urlParams = new URLSearchParams(search); + const page = urlParams.get('page') || 0; + return { + claimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state), + fetching: makeSelectFetchingChannelClaims(props.uri)(state), + totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state), + channelIsMine: makeSelectClaimIsMine(props.uri)(state), + }; +}; const perform = dispatch => ({ fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)), }); -export default connect( - select, - perform -)(ChannelPage); +export default withRouter( + connect( + select, + perform + )(ChannelPage) +);