selectClaimIdIsPending

This commit is contained in:
zeppi 2021-06-23 10:43:17 -04:00 committed by jessopb
parent 508e8d36fd
commit 0b505fb0f4
3 changed files with 19 additions and 6 deletions

7
dist/bundle.es.js vendored
View file

@ -2418,6 +2418,10 @@ const makeSelectClaimIsPending = uri => reselect.createSelector(selectClaimIdsBy
return false;
});
const makeSelectClaimIdIsPending = claimId => reselect.createSelector(selectPendingIds, pendingIds => {
return pendingIds.some(i => i === claimId);
});
const makeSelectClaimIdForUri = uri => reselect.createSelector(selectClaimIdsByUri, claimIds => claimIds[uri]);
const selectReflectingById = reselect.createSelector(selectState$1, state => state.reflectingById);
@ -2632,7 +2636,7 @@ const selectMyClaims = reselect.createSelector(selectMyActiveClaims, selectClaim
return [...claims];
});
const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp));
const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => claim && !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp));
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => {
return myClaims.sort((a, b) => {
@ -7927,6 +7931,7 @@ exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId;
exports.makeSelectClaimForUri = makeSelectClaimForUri;
exports.makeSelectClaimHasSource = makeSelectClaimHasSource;
exports.makeSelectClaimIdForUri = makeSelectClaimIdForUri;
exports.makeSelectClaimIdIsPending = makeSelectClaimIdIsPending;
exports.makeSelectClaimIdsForCollectionId = makeSelectClaimIdsForCollectionId;
exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw;

View file

@ -282,6 +282,7 @@ export {
selectUpdateCollectionError,
selectCreatingCollection,
selectCreateCollectionError,
makeSelectClaimIdIsPending,
} from 'redux/selectors/claims';
export {

View file

@ -95,6 +95,13 @@ export const makeSelectClaimIsPending = (uri: string) =>
}
);
export const makeSelectClaimIdIsPending = (claimId: string) => createSelector(
selectPendingIds,
(pendingIds) => {
return pendingIds.some(i => i === claimId);
}
);
export const makeSelectClaimIdForUri = (uri: string) =>
createSelector(
selectClaimIdsByUri,
@ -279,8 +286,8 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
const end = Number(page) * Number(CLAIM.PAGE_SIZE);
return matchingFileInfos && matchingFileInfos.length
? matchingFileInfos
.slice(start, end)
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
.slice(start, end)
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
: [];
}
);
@ -386,8 +393,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;
}
@ -493,7 +500,7 @@ export const selectMyClaims = createSelector(
export const selectMyClaimsWithoutChannels = createSelector(
selectMyClaims,
myClaims =>
myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp)
myClaims.filter(claim => claim && !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp)
);
export const selectMyClaimUrisWithoutChannels = createSelector(