remove fetchClaimsCount call on channel pages

This commit is contained in:
Sean Yesmunt 2018-11-27 10:49:54 -05:00
parent 496c06beb5
commit e618b491e6
3 changed files with 3 additions and 51 deletions

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doFetchClaimsByChannel, doFetchClaimCountByChannel } from 'redux/actions/content'; import { doFetchClaimsByChannel } from 'redux/actions/content';
import { PAGE_SIZE } from 'constants/claim'; import { PAGE_SIZE } from 'constants/claim';
import { import {
makeSelectClaimForUri, makeSelectClaimForUri,
@ -26,7 +26,6 @@ const select = (state, props) => ({
const perform = dispatch => ({ const perform = dispatch => ({
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)), fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)),
navigate: (path, params) => dispatch(doNavigate(path, params)), navigate: (path, params) => dispatch(doNavigate(path, params)),
openModal: (modal, props) => dispatch(doOpenModal(modal, props)), openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
}); });

View file

@ -22,28 +22,22 @@ type Props = {
claimsInChannel: Array<Claim>, claimsInChannel: Array<Claim>,
channelIsMine: boolean, channelIsMine: boolean,
fetchClaims: (string, number) => void, fetchClaims: (string, number) => void,
fetchClaimCount: string => void,
navigate: (string, {}) => void, navigate: (string, {}) => void,
openModal: ({ id: string }, { uri: string }) => void, openModal: ({ id: string }, { uri: string }) => void,
}; };
class ChannelPage extends React.PureComponent<Props> { class ChannelPage extends React.PureComponent<Props> {
componentDidMount() { componentDidMount() {
const { uri, page, fetchClaims, fetchClaimCount } = this.props; const { uri, page, fetchClaims } = this.props;
fetchClaims(uri, page || 1); fetchClaims(uri, page || 1);
fetchClaimCount(uri);
} }
componentWillReceiveProps(nextProps: Props) { componentWillReceiveProps(nextProps: Props) {
const { page, uri, fetchClaims, fetchClaimCount } = this.props; const { page, fetchClaims } = this.props;
if (nextProps.page && page !== nextProps.page) { if (nextProps.page && page !== nextProps.page) {
fetchClaims(nextProps.uri, nextProps.page); fetchClaims(nextProps.uri, nextProps.page);
} }
if (nextProps.uri !== uri) {
fetchClaimCount(uri);
}
} }
changePage(pageNumber: number) { changePage(pageNumber: number) {

View file

@ -14,7 +14,6 @@ import {
Lbry, Lbry,
Lbryapi, Lbryapi,
buildURI, buildURI,
doFetchClaimListMine,
makeSelectCostInfoForUri, makeSelectCostInfoForUri,
makeSelectFileInfoForUri, makeSelectFileInfoForUri,
selectFileInfosByOutpoint, selectFileInfosByOutpoint,
@ -331,28 +330,6 @@ export function doFetchClaimsByChannel(uri, page, pageSize) {
}; };
} }
export function doFetchClaimCountByChannel(uri) {
return dispatch => {
dispatch({
type: ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_STARTED,
data: { uri },
});
Lbry.claim_list_by_channel({ uri }).then(result => {
const claimResult = result[uri];
const totalClaims = claimResult ? claimResult.claims_in_channel : 0;
dispatch({
type: ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_COMPLETED,
data: {
uri,
totalClaims,
},
});
});
};
}
export function doPlayUri(uri) { export function doPlayUri(uri) {
return dispatch => { return dispatch => {
dispatch(doSetPlayingUri(uri)); dispatch(doSetPlayingUri(uri));
@ -405,24 +382,6 @@ export function doCreateChannel(name: string, amount: number) {
}; };
} }
export function doPublish(params) {
return dispatch =>
new Promise((resolve, reject) => {
const success = claim => {
resolve(claim);
if (claim === true) dispatch(doFetchClaimListMine());
else
setTimeout(() => dispatch(doFetchClaimListMine()), 20000, {
once: true,
});
};
const failure = err => reject(err);
Lbry.publishDeprecated(params, null, success, failure);
});
}
export function savePosition(claimId: string, outpoint: string, position: number) { export function savePosition(claimId: string, outpoint: string, position: number) {
return dispatch => { return dispatch => {
dispatch({ dispatch({