fix issue with null claims in stats selectors

This commit is contained in:
Akinwale Ariwodola 2019-12-20 08:45:03 +01:00
parent 1e897d2c91
commit 053ca52f4f
3 changed files with 6 additions and 6 deletions

4
dist/bundle.es.js vendored
View file

@ -3434,8 +3434,8 @@ const selectState$8 = state => state.stats || {};
const selectViewCount = reselect.createSelector(selectState$8, state => state.viewCountById);
const selectSubCount = reselect.createSelector(selectState$8, state => state.subCountById);
const makeSelectViewCountForUri = uri => reselect.createSelector(lbryRedux.makeSelectClaimForUri(uri), selectViewCount, (claim, viewCountById) => viewCountById[claim.claim_id] || 0);
const makeSelectSubCountForUri = uri => reselect.createSelector(lbryRedux.makeSelectClaimForUri(uri), selectSubCount, (claim, subCountById) => subCountById[claim.claim_id] || 0);
const makeSelectViewCountForUri = uri => reselect.createSelector(lbryRedux.makeSelectClaimForUri(uri), selectViewCount, (claim, viewCountById) => claim ? viewCountById[claim.claim_id] || 0 : 0);
const makeSelectSubCountForUri = uri => reselect.createSelector(lbryRedux.makeSelectClaimForUri(uri), selectSubCount, (claim, subCountById) => claim ? subCountById[claim.claim_id] || 0 : 0);
const selectState$9 = state => state.sync || {};

4
dist/bundle.js vendored
View file

@ -7488,12 +7488,12 @@ var selectSubCount = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelecto
});
var makeSelectViewCountForUri = function makeSelectViewCountForUri(uri) {
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(Object(lbry_redux__WEBPACK_IMPORTED_MODULE_1__["makeSelectClaimForUri"])(uri), selectViewCount, function (claim, viewCountById) {
return viewCountById[claim.claim_id] || 0;
return claim ? viewCountById[claim.claim_id] || 0 : 0;
});
};
var makeSelectSubCountForUri = function makeSelectSubCountForUri(uri) {
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(Object(lbry_redux__WEBPACK_IMPORTED_MODULE_1__["makeSelectClaimForUri"])(uri), selectSubCount, function (claim, subCountById) {
return subCountById[claim.claim_id] || 0;
return claim ? subCountById[claim.claim_id] || 0 : 0;
});
};

View file

@ -9,12 +9,12 @@ export const makeSelectViewCountForUri = uri =>
createSelector(
makeSelectClaimForUri(uri),
selectViewCount,
(claim, viewCountById) => viewCountById[claim.claim_id] || 0
(claim, viewCountById) => (claim ? viewCountById[claim.claim_id] || 0 : 0)
);
export const makeSelectSubCountForUri = uri =>
createSelector(
makeSelectClaimForUri(uri),
selectSubCount,
(claim, subCountById) => subCountById[claim.claim_id] || 0
(claim, subCountById) => (claim ? subCountById[claim.claim_id] || 0 : 0)
);