diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 01a1227..0a5e917 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2237,15 +2237,19 @@ const selectMyClaims = reselect.createSelector(selectMyActiveClaims, selectClaim const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp)); -const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => myClaims.sort((a, b) => { - if (!a.timestamp) { - return -1; - } else if (!b.timestamp) { - return 1; - } else { - return b.timestamp - a.timestamp; - } -}).map(claim => claim.canonical_url)); +const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => { + return myClaims.sort((a, b) => { + if (a.height < 1) { + return -1; + } else if (b.height < 1) { + return 1; + } else { + return b.timestamp - a.timestamp; + } + }).map(claim => { + return claim.canonical_url || claim.permanent_url; + }); +}); const selectAllMyClaimsByOutpoint = reselect.createSelector(selectMyClaimsRaw, claims => new Set(claims && claims.length ? claims.map(claim => `${claim.txid}:${claim.nout}`) : null)); @@ -2424,6 +2428,7 @@ const selectUpdateChannelError = reselect.createSelector(selectState$2, state => const makeSelectMyStreamUrlsForPage = (page = 1) => reselect.createSelector(selectMyClaimUrisWithoutChannels, urls => { const start = (Number(page) - 1) * Number(PAGE_SIZE); const end = Number(page) * Number(PAGE_SIZE); + return urls && urls.length ? urls.slice(start, end) : []; }); diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 2200069..ec860a2 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -310,8 +310,8 @@ export const makeSelectDateForUri = (uri: string) => (claim.value.release_time ? claim.value.release_time * 1000 : claim.meta && claim.meta.creation_timestamp - ? claim.meta.creation_timestamp * 1000 - : null); + ? claim.meta.creation_timestamp * 1000 + : null); if (!timestamp) { return undefined; } @@ -386,18 +386,21 @@ export const selectMyClaimsWithoutChannels = createSelector( export const selectMyClaimUrisWithoutChannels = createSelector( selectMyClaimsWithoutChannels, - myClaims => - myClaims + myClaims => { + return myClaims .sort((a, b) => { - if (!a.timestamp) { + if (a.height < 1) { return -1; - } else if (!b.timestamp) { + } else if (b.height < 1) { return 1; } else { return b.timestamp - a.timestamp; } }) - .map(claim => claim.canonical_url) + .map(claim => { + return claim.canonical_url || claim.permanent_url; + }); + } ); export const selectAllMyClaimsByOutpoint = createSelector( @@ -694,6 +697,7 @@ export const makeSelectMyStreamUrlsForPage = (page: number = 1) => urls => { const start = (Number(page) - 1) * Number(PAGE_SIZE); const end = Number(page) * Number(PAGE_SIZE); + return urls && urls.length ? urls.slice(start, end) : []; } );