fix myPurchases selector

This commit is contained in:
Sean Yesmunt 2020-05-21 09:38:30 -04:00
parent 910b55f059
commit aa2cfa7896
3 changed files with 13 additions and 2 deletions

7
dist/bundle.es.js vendored
View file

@ -2313,6 +2313,11 @@ const makeSelectMyPurchasesForPage = (query, page = 1) => reselect.createSelecto
return undefined;
}
if (!query) {
// ensure no duplicates from double purchase bugs
return [...new Set(myPurchases)];
}
const fileInfos = myPurchases.map(uri => claimsByUri[uri]);
const matchingFileInfos = filterClaims(fileInfos, query);
const start = (Number(page) - 1) * Number(PAGE_SIZE);
@ -3752,7 +3757,7 @@ function doClearRepostError() {
};
}
function doPurchaseList(page = 1, pageSize = 99999) {
function doPurchaseList(page = 1, pageSize = PAGE_SIZE) {
return dispatch => {
dispatch({
type: PURCHASE_LIST_STARTED

View file

@ -15,6 +15,7 @@ import { selectSupportsByOutpoint } from 'redux/selectors/wallet';
import { creditsToString } from 'util/format-credits';
import { batchActions } from 'util/batch-actions';
import { createNormalizedClaimSearchKey } from 'util/claim';
import { PAGE_SIZE } from 'constants/claim';
export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean = false) {
return (dispatch: Dispatch, getState: GetState) => {
@ -630,7 +631,7 @@ export function doClearRepostError() {
};
}
export function doPurchaseList(page: number = 1, pageSize: number = 99999) {
export function doPurchaseList(page: number = 1, pageSize: number = PAGE_SIZE) {
return (dispatch: Dispatch) => {
dispatch({
type: ACTIONS.PURCHASE_LIST_STARTED,

View file

@ -260,6 +260,11 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
return undefined;
}
if (!query) {
// ensure no duplicates from double purchase bugs
return [...new Set(myPurchases)];
}
const fileInfos = myPurchases.map(uri => claimsByUri[uri]);
const matchingFileInfos = filterClaims(fileInfos, query);
const start = (Number(page) - 1) * Number(PAGE_SIZE);