Merge pull request #101 from lbryio/feat-filteredSelectors

selectors for blocklist objects
This commit is contained in:
Sean Yesmunt 2020-08-14 13:20:23 -04:00 committed by GitHub
commit c1a08e2e97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 2 deletions

14
dist/bundle.es.js vendored
View file

@ -1464,9 +1464,21 @@ const makeSelectFetchingCostInfoForUri = uri => reselect.createSelector(selectFe
const selectState$2 = state => state.blacklist || {};
const selectBlackListedOutpoints = reselect.createSelector(selectState$2, state => state.blackListedOutpoints);
const selectBlacklistedOutpointMap = reselect.createSelector(selectBlackListedOutpoints, outpoints => outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
return { ...acc,
[outpoint]: 1
};
}, {}));
const selectState$3 = state => state.filtered || {};
const selectFilteredOutpoints = reselect.createSelector(selectState$3, state => state.filteredOutpoints);
const selectFilteredOutpointMap = reselect.createSelector(selectFilteredOutpoints, outpoints => outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
return { ...acc,
[outpoint]: 1
};
}, {}));
const selectState$4 = state => state.homepage || {};
@ -1534,11 +1546,13 @@ exports.makeSelectViewCountForUri = makeSelectViewCountForUri;
exports.selectAllCostInfoByUri = selectAllCostInfoByUri;
exports.selectAuthToken = selectAuthToken;
exports.selectBlackListedOutpoints = selectBlackListedOutpoints;
exports.selectBlacklistedOutpointMap = selectBlacklistedOutpointMap;
exports.selectCurrentUploads = selectCurrentUploads;
exports.selectFeaturedUris = selectFeaturedUris;
exports.selectFetchingCostInfo = selectFetchingCostInfo;
exports.selectFetchingFeaturedUris = selectFetchingFeaturedUris;
exports.selectFetchingTrendingUris = selectFetchingTrendingUris;
exports.selectFilteredOutpointMap = selectFilteredOutpointMap;
exports.selectFilteredOutpoints = selectFilteredOutpoints;
exports.selectGetSyncErrorMessage = selectGetSyncErrorMessage;
exports.selectGetSyncIsPending = selectGetSyncIsPending;

26
dist/bundle.js vendored
View file

@ -193,9 +193,13 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(35);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectBlackListedOutpoints", function() { return redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_23__["selectBlackListedOutpoints"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectBlacklistedOutpointMap", function() { return redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_23__["selectBlacklistedOutpointMap"]; });
/* harmony import */ var redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(36);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpoints", function() { return redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_24__["selectFilteredOutpoints"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpointMap", function() { return redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_24__["selectFilteredOutpointMap"]; });
/* harmony import */ var redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(37);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFeaturedUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__["selectFeaturedUris"]; });
@ -4537,8 +4541,13 @@ var makeSelectFetchingCostInfoForUri = function makeSelectFetchingCostInfoForUri
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectState", function() { return selectState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectBlackListedOutpoints", function() { return selectBlackListedOutpoints; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectBlacklistedOutpointMap", function() { return selectBlacklistedOutpointMap; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var selectState = function selectState(state) {
return state.blacklist || {};
@ -4546,6 +4555,12 @@ var selectState = function selectState(state) {
var selectBlackListedOutpoints = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.blackListedOutpoints;
});
var selectBlacklistedOutpointMap = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectBlackListedOutpoints, function (outpoints) {
return outpoints.reduce(function (acc, val) {
var outpoint = "".concat(val.txid, ":").concat(val.nout);
return _objectSpread({}, acc, _defineProperty({}, outpoint, 1));
}, {});
});
/***/ }),
/* 36 */
@ -4555,8 +4570,13 @@ var selectBlackListedOutpoints = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["c
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectState", function() { return selectState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpoints", function() { return selectFilteredOutpoints; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpointMap", function() { return selectFilteredOutpointMap; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var selectState = function selectState(state) {
return state.filtered || {};
@ -4564,6 +4584,12 @@ var selectState = function selectState(state) {
var selectFilteredOutpoints = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.filteredOutpoints;
});
var selectFilteredOutpointMap = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectFilteredOutpoints, function (outpoints) {
return outpoints.reduce(function (acc, val) {
var outpoint = "".concat(val.txid, ":").concat(val.nout);
return _objectSpread({}, acc, _defineProperty({}, outpoint, 1));
}, {});
});
/***/ }),
/* 37 */

View file

@ -47,8 +47,11 @@ export {
selectAllCostInfoByUri,
selectFetchingCostInfo,
} from 'redux/selectors/cost_info';
export { selectBlackListedOutpoints } from 'redux/selectors/blacklist';
export { selectFilteredOutpoints } from 'redux/selectors/filtered';
export {
selectBlackListedOutpoints,
selectBlacklistedOutpointMap,
} from 'redux/selectors/blacklist';
export { selectFilteredOutpoints, selectFilteredOutpointMap } from 'redux/selectors/filtered';
export {
selectFeaturedUris,
selectFetchingFeaturedUris,

View file

@ -6,3 +6,13 @@ export const selectBlackListedOutpoints = createSelector(
selectState,
state => state.blackListedOutpoints
);
export const selectBlacklistedOutpointMap = createSelector(selectBlackListedOutpoints, outpoints =>
outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
return {
...acc,
[outpoint]: 1,
};
}, {})
);

View file

@ -6,3 +6,13 @@ export const selectFilteredOutpoints = createSelector(
selectState,
state => state.filteredOutpoints
);
export const selectFilteredOutpointMap = createSelector(selectFilteredOutpoints, outpoints =>
outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
return {
...acc,
[outpoint]: 1,
};
}, {})
);