Reduce unnecessary api calls
This commit is contained in:
parent
3f8f25dc43
commit
174285aea8
2 changed files with 21 additions and 13 deletions
|
@ -14,6 +14,7 @@ import { makeSelectCostInfoForUri } from 'redux/selectors/cost_info';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import FilePage from './view';
|
import FilePage from './view';
|
||||||
import { makeSelectCurrentParam } from 'redux/selectors/navigation';
|
import { makeSelectCurrentParam } from 'redux/selectors/navigation';
|
||||||
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
|
@ -24,6 +25,7 @@ const select = (state, props) => ({
|
||||||
tab: makeSelectCurrentParam('tab')(state),
|
tab: makeSelectCurrentParam('tab')(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
||||||
|
subscriptions: selectSubscriptions(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -37,6 +37,11 @@ class FilePage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkSubscriptionLatest(props) {
|
checkSubscriptionLatest(props) {
|
||||||
|
if (
|
||||||
|
props.subscriptions
|
||||||
|
.map(subscription => subscription.channelName)
|
||||||
|
.indexOf(props.claim.channel_name) !== -1
|
||||||
|
) {
|
||||||
props.checkSubscriptionLatest(
|
props.checkSubscriptionLatest(
|
||||||
{
|
{
|
||||||
channelName: props.claim.channel_name,
|
channelName: props.claim.channel_name,
|
||||||
|
@ -51,6 +56,7 @@ class FilePage extends React.PureComponent {
|
||||||
buildURI({ contentName: props.claim.name, claimId: props.claim.claim_id }, false)
|
buildURI({ contentName: props.claim.name, claimId: props.claim.claim_id }, false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
|
Loading…
Reference in a new issue