Uses a constant for PAGE_SIZE #2089
7 changed files with 117 additions and 113 deletions
|
@ -49,7 +49,7 @@
|
|||
"formik": "^0.10.4",
|
||||
"hast-util-sanitize": "^1.1.2",
|
||||
"keytar": "^4.2.1",
|
||||
"lbry-redux": "lbryio/lbry-redux#dd26422a86a37b5a492dc0702269ad6fc04ecdd7",
|
||||
"lbry-redux": "lbryio/lbry-redux#aa10240bc1e90dff299821e31a88edcb4c5fd295",
|
||||
"lbryinc": "lbryio/lbryinc#7a458ea13ceceffa0191e73139f94e5c953f22b1",
|
||||
"localforage": "^1.7.1",
|
||||
"mammoth": "^1.4.6",
|
||||
|
|
|
@ -2,3 +2,4 @@ export const MINIMUM_PUBLISH_BID = 0.00000001;
|
|||
|
||||
export const CHANNEL_ANONYMOUS = 'anonymous';
|
||||
export const CHANNEL_NEW = 'new';
|
||||
export const PAGE_SIZE = 20;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doFetchClaimsByChannel, doFetchClaimCountByChannel } from 'redux/actions/content';
|
||||
import { PAGE_SIZE } from 'constants/claim';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimsInChannelForCurrentPage,
|
||||
makeSelectFetchingChannelClaims,
|
||||
makeSelectCurrentParam,
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectTotalPagesForChannel,
|
||||
selectCurrentParams,
|
||||
} from 'lbry-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { makeSelectTotalPagesForChannel } from 'redux/selectors/content';
|
||||
import ChannelPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
|
@ -18,7 +19,7 @@ const select = (state, props) => ({
|
|||
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
||||
page: makeSelectCurrentParam('page')(state),
|
||||
params: selectCurrentParams(state),
|
||||
totalPages: makeSelectTotalPagesForChannel(props.uri)(state),
|
||||
totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state),
|
||||
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// @flow
|
||||
import * as NOTIFICATION_TYPES from 'constants/subscriptions';
|
||||
import { PAGE_SIZE } from 'constants/claim';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { doAlertError } from 'redux/actions/app';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
|
@ -293,7 +294,8 @@ export function doFetchClaimsByChannel(uri, page, pageSize) {
|
|||
data: { uri, page },
|
||||
});
|
||||
|
||||
Lbry.claim_list_by_channel({ uri, page: page || 1, page_size: pageSize || 20 }).then(result => {
|
||||
Lbry.claim_list_by_channel({ uri, page: page || 1, page_size: pageSize || PAGE_SIZE }).then(
|
||||
result => {
|
||||
const claimResult = result[uri] || {};
|
||||
const { claims_in_channel: claimsInChannel, returned_page: returnedPage } = claimResult;
|
||||
|
||||
|
@ -324,7 +326,8 @@ export function doFetchClaimsByChannel(uri, page, pageSize) {
|
|||
page: returnedPage || undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import type {
|
|||
ViewMode,
|
||||
UnreadSubscription,
|
||||
} from 'types/subscription';
|
||||
import { PAGE_SIZE } from 'constants/claim';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import * as NOTIFICATION_TYPES from 'constants/subscriptions';
|
||||
|
@ -223,7 +224,9 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
|||
);
|
||||
}
|
||||
|
||||
Lbry.claim_list_by_channel({ uri: subscriptionUri, page: 1 }).then(claimListByChannel => {
|
||||
// We may be duplicating calls here. Can this logic be baked into doFetchClaimsByChannel?
|
||||
Lbry.claim_list_by_channel({ uri: subscriptionUri, page: 1, page_size: PAGE_SIZE }).then(
|
||||
claimListByChannel => {
|
||||
const claimResult = claimListByChannel[subscriptionUri] || {};
|
||||
const { claims_in_channel: claimsInChannel } = claimResult;
|
||||
|
||||
|
@ -250,7 +253,9 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
|||
const uri = buildURI({ contentName: claim.name, claimId: claim.claim_id }, true);
|
||||
const shouldDownload =
|
||||
shouldAutoDownload &&
|
||||
Boolean(downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee);
|
||||
Boolean(
|
||||
downloadCount < SUBSCRIPTION_DOWNLOAD_LIMIT && !claim.value.stream.metadata.fee
|
||||
);
|
||||
|
||||
// Add the new content to the list of "un-read" subscriptions
|
||||
if (shouldNotify) {
|
||||
|
@ -303,7 +308,8 @@ export const doCheckSubscription = (subscriptionUri: string, shouldNotify?: bool
|
|||
page: 1,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const doChannelSubscribe = (subscription: Subscription) => (
|
||||
|
|
|
@ -14,12 +14,6 @@ export const selectChannelClaimCounts = createSelector(
|
|||
export const makeSelectTotalItemsForChannel = uri =>
|
||||
createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri]);
|
||||
|
||||
export const makeSelectTotalPagesForChannel = uri =>
|
||||
createSelector(
|
||||
selectChannelClaimCounts,
|
||||
byUri => byUri && byUri[uri] && Math.ceil(byUri[uri] / 10)
|
||||
);
|
||||
|
||||
export const selectRewardContentClaimIds = createSelector(
|
||||
selectState,
|
||||
state => state.rewardedContentClaimIds
|
||||
|
@ -52,9 +46,8 @@ export const makeSelectHistoryForPage = page =>
|
|||
|
||||
if (claimAtUri) {
|
||||
return { lastViewed, uri, ...claimAtUri };
|
||||
} else {
|
||||
return historyItem;
|
||||
}
|
||||
return historyItem;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -5663,16 +5663,16 @@ lazy-val@^1.0.3:
|
|||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux#0e13dd1972e3b40821fee2f9f06e1a0631913aa9:
|
||||
lbry-redux@lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/0e13dd1972e3b40821fee2f9f06e1a0631913aa9"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2375860d6269d0369418879c2531b1d48c4e47f2"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2:
|
||||
lbry-redux@lbryio/lbry-redux#aa10240bc1e90dff299821e31a88edcb4c5fd295:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2375860d6269d0369418879c2531b1d48c4e47f2"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/aa10240bc1e90dff299821e31a88edcb4c5fd295"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
|
Loading…
Reference in a new issue