From adbbd7e66019239409cd51ce3b8b1a42071bea83 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 14 Aug 2019 13:08:38 -0400 Subject: [PATCH] fix: loading selector after getting rid of urisLoading - missed this --- dist/bundle.es.js | 13 +++++++++++-- src/redux/selectors/file_info.js | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 4aa187a..aeb5956 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2452,9 +2452,18 @@ const makeSelectDownloadingForUri = uri => reselect.createSelector(selectDownloa return byOutpoint[fileInfo.outpoint]; }); -const selectUrisLoading = reselect.createSelector(selectState$3, state => state.urisLoading || {}); +const selectUrisLoading = reselect.createSelector(selectState$3, state => state.fetching || {}); -const makeSelectLoadingForUri = uri => reselect.createSelector(selectUrisLoading, byUri => byUri && byUri[uri]); +const makeSelectLoadingForUri = uri => reselect.createSelector(selectUrisLoading, makeSelectClaimForUri(uri), (fetchingByOutpoint, claim) => { + if (!claim) { + return false; + } + + const { txid, nout } = claim; + const outpoint = `${txid}:${nout}`; + const isFetching = fetchingByOutpoint[outpoint]; + return isFetching; +}); const selectFileInfosDownloaded = reselect.createSelector(selectFileInfosByOutpoint, selectMyClaims, (byOutpoint, myClaims) => Object.values(byOutpoint).filter(fileInfo => { const myClaimIds = myClaims.map(claim => claim.claim_id); diff --git a/src/redux/selectors/file_info.js b/src/redux/selectors/file_info.js index 8c014c5..25af571 100644 --- a/src/redux/selectors/file_info.js +++ b/src/redux/selectors/file_info.js @@ -56,13 +56,23 @@ export const makeSelectDownloadingForUri = uri => export const selectUrisLoading = createSelector( selectState, - state => state.urisLoading || {} + state => state.fetching || {} ); export const makeSelectLoadingForUri = uri => createSelector( selectUrisLoading, - byUri => byUri && byUri[uri] + makeSelectClaimForUri(uri), + (fetchingByOutpoint, claim) => { + if (!claim) { + return false; + } + + const { txid, nout } = claim; + const outpoint = `${txid}:${nout}`; + const isFetching = fetchingByOutpoint[outpoint]; + return isFetching; + } ); export const selectFileInfosDownloaded = createSelector(