From 9fa349f3c1e3cbc68503ca61a6b867531c599509 Mon Sep 17 00:00:00 2001 From: jessop Date: Fri, 3 Jan 2020 14:06:35 -0500 Subject: [PATCH] fix error when listBlocked response is null and remove unneccesary lbry-redux non-peer dependency --- dist/bundle.es.js | 41 ++++++++++++++++---------- dist/bundle.js | 53 ++++++++++++++++++++-------------- package.json | 1 - src/redux/actions/blacklist.js | 14 +++++---- src/redux/actions/filtered.js | 11 ++++--- yarn.lock | 16 ---------- 6 files changed, 71 insertions(+), 65 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 1ec1ea9..9eb44cc 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2218,18 +2218,22 @@ function doFetchBlackListedOutpoints() { const success = ({ outpoints }) => { - const splitedOutpoints = []; - outpoints.forEach((outpoint, index) => { - const [txid, nout] = outpoint.split(':'); - splitedOutpoints[index] = { - txid, - nout: Number.parseInt(nout, 10) - }; - }); + const splitOutpoints = []; + + if (outpoints) { + outpoints.forEach((outpoint, index) => { + const [txid, nout] = outpoint.split(':'); + splitOutpoints[index] = { + txid, + nout: Number.parseInt(nout, 10) + }; + }); + } + dispatch({ type: FETCH_BLACK_LISTED_CONTENT_COMPLETED, data: { - outpoints: splitedOutpoints, + outpoints: splitOutpoints, success: true } }); @@ -2267,13 +2271,18 @@ function doFetchFilteredOutpoints() { const success = ({ outpoints }) => { - const formattedOutpoints = outpoints.map(outpoint => { - const [txid, nout] = outpoint.split(':'); - return { - txid, - nout: Number.parseInt(nout, 10) - }; - }); + let formattedOutpoints = []; + + if (outpoints) { + formattedOutpoints = outpoints.map(outpoint => { + const [txid, nout] = outpoint.split(':'); + return { + txid, + nout: Number.parseInt(nout, 10) + }; + }); + } + dispatch({ type: FETCH_FILTERED_CONTENT_COMPLETED, data: { diff --git a/dist/bundle.js b/dist/bundle.js index 6fb607f..a965218 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -5822,22 +5822,26 @@ function doFetchBlackListedOutpoints() { var success = function success(_ref) { var outpoints = _ref.outpoints; - var splitedOutpoints = []; - outpoints.forEach(function (outpoint, index) { - var _outpoint$split = outpoint.split(':'), - _outpoint$split2 = _slicedToArray(_outpoint$split, 2), - txid = _outpoint$split2[0], - nout = _outpoint$split2[1]; + var splitOutpoints = []; + + if (outpoints) { + outpoints.forEach(function (outpoint, index) { + var _outpoint$split = outpoint.split(':'), + _outpoint$split2 = _slicedToArray(_outpoint$split, 2), + txid = _outpoint$split2[0], + nout = _outpoint$split2[1]; + + splitOutpoints[index] = { + txid: txid, + nout: Number.parseInt(nout, 10) + }; + }); + } - splitedOutpoints[index] = { - txid: txid, - nout: Number.parseInt(nout, 10) - }; - }); dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["FETCH_BLACK_LISTED_CONTENT_COMPLETED"], data: { - outpoints: splitedOutpoints, + outpoints: splitOutpoints, success: true } }); @@ -5895,17 +5899,22 @@ function doFetchFilteredOutpoints() { var success = function success(_ref) { var outpoints = _ref.outpoints; - var formattedOutpoints = outpoints.map(function (outpoint) { - var _outpoint$split = outpoint.split(':'), - _outpoint$split2 = _slicedToArray(_outpoint$split, 2), - txid = _outpoint$split2[0], - nout = _outpoint$split2[1]; + var formattedOutpoints = []; + + if (outpoints) { + formattedOutpoints = outpoints.map(function (outpoint) { + var _outpoint$split = outpoint.split(':'), + _outpoint$split2 = _slicedToArray(_outpoint$split, 2), + txid = _outpoint$split2[0], + nout = _outpoint$split2[1]; + + return { + txid: txid, + nout: Number.parseInt(nout, 10) + }; + }); + } - return { - txid: txid, - nout: Number.parseInt(nout, 10) - }; - }); dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["FETCH_FILTERED_CONTENT_COMPLETED"], data: { diff --git a/package.json b/package.json index 5f07900..26e71cb 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "flow-bin": "^0.69.0", "flow-typed": "^2.4.0", "husky": "^0.14.3", - "lbry-redux": "lbryio/lbry-redux", "lint-staged": "^7.0.4", "prettier": "^1.4.2", "rollup": "^1.8.0", diff --git a/src/redux/actions/blacklist.js b/src/redux/actions/blacklist.js index c3991e9..838565f 100644 --- a/src/redux/actions/blacklist.js +++ b/src/redux/actions/blacklist.js @@ -10,17 +10,19 @@ export function doFetchBlackListedOutpoints() { }); const success = ({ outpoints }) => { - const splitedOutpoints = []; + const splitOutpoints = []; + if (outpoints) { + outpoints.forEach((outpoint, index) => { + const [txid, nout] = outpoint.split(':'); - outpoints.forEach((outpoint, index) => { - const [txid, nout] = outpoint.split(':'); + splitOutpoints[index] = { txid, nout: Number.parseInt(nout, 10) }; + }); + } - splitedOutpoints[index] = { txid, nout: Number.parseInt(nout, 10) }; - }); dispatch({ type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_COMPLETED, data: { - outpoints: splitedOutpoints, + outpoints: splitOutpoints, success: true, }, }); diff --git a/src/redux/actions/filtered.js b/src/redux/actions/filtered.js index 6e9fdb1..1b8313b 100644 --- a/src/redux/actions/filtered.js +++ b/src/redux/actions/filtered.js @@ -10,10 +10,13 @@ export function doFetchFilteredOutpoints() { }); const success = ({ outpoints }) => { - const formattedOutpoints = outpoints.map(outpoint => { - const [txid, nout] = outpoint.split(':'); - return { txid, nout: Number.parseInt(nout, 10) }; - }); + let formattedOutpoints = []; + if (outpoints) { + formattedOutpoints = outpoints.map(outpoint => { + const [txid, nout] = outpoint.split(':'); + return { txid, nout: Number.parseInt(nout, 10) }; + }); + } dispatch({ type: ACTIONS.FETCH_FILTERED_CONTENT_COMPLETED, diff --git a/yarn.lock b/yarn.lock index e9b97cf..d91dbe4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3343,14 +3343,6 @@ kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" -lbry-redux@lbryio/lbry-redux: - version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/f140db38dd73cead9e87549340fa9434da62ba8a" - dependencies: - proxy-polyfill "0.1.6" - reselect "^3.0.0" - uuid "^3.3.2" - lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" @@ -4365,10 +4357,6 @@ promise-inflight@^1.0.1: resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= -proxy-polyfill@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/proxy-polyfill/-/proxy-polyfill-0.1.6.tgz#ef41ec6c66f534db15db36c54493a62d184b364e" - prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" @@ -5462,10 +5450,6 @@ util@^0.11.0: dependencies: inherits "2.0.3" -uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - v8-compile-cache@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe"