so much discovery I can't take it #2617

Merged
neb-b merged 20 commits from fixes into master 2019-07-23 01:45:30 +02:00
Showing only changes of commit f6c70c7072 - Show all commits

View file

@ -2,25 +2,34 @@ import { connect } from 'react-redux';
import { doFetchClaimsByChannel } from 'redux/actions/content'; import { doFetchClaimsByChannel } from 'redux/actions/content';
import { PAGE_SIZE } from 'constants/claim'; import { PAGE_SIZE } from 'constants/claim';
import { import {
makeSelectClaimsInChannelForCurrentPageState, makeSelectClaimsInChannelForPage,
makeSelectFetchingChannelClaims, makeSelectFetchingChannelClaims,
makeSelectClaimIsMine, makeSelectClaimIsMine,
makeSelectTotalPagesForChannel, makeSelectTotalPagesForChannel,
} from 'lbry-redux'; } from 'lbry-redux';
import { withRouter } from 'react-router';
import ChannelPage from './view'; import ChannelPage from './view';
const select = (state, props) => ({ const select = (state, props) => {
claimsInChannel: makeSelectClaimsInChannelForCurrentPageState(props.uri)(state), console.log('props', props);
fetching: makeSelectFetchingChannelClaims(props.uri)(state), const { search } = props.location;
totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state), const urlParams = new URLSearchParams(search);
channelIsMine: makeSelectClaimIsMine(props.uri)(state), 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 => ({ const perform = dispatch => ({
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)), fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
}); });
export default connect( export default withRouter(
select, connect(
perform select,
)(ChannelPage); perform
)(ChannelPage)
);