fix selector to properly return null for abandoned claims

This commit is contained in:
Sean Yesmunt 2020-06-23 11:15:17 -04:00
parent d915f965b4
commit 5ac2065b61
2 changed files with 13 additions and 7 deletions

9
dist/bundle.es.js vendored
View file

@ -2227,9 +2227,12 @@ const makeSelectClaimForUri = (uri, returnRepost = true) => reselect.createSelec
if (validUri && byUri) { if (validUri && byUri) {
const claimId = uri && byUri[normalizeURI(uri)]; const claimId = uri && byUri[normalizeURI(uri)];
const claim = byId[claimId]; const claim = byId[claimId];
if (claim === undefined || claim === null) {
// Make sure to return the claim as is so apps can check if it's been resolved before (null) or still needs to be resolved (undefined) // Make sure to return the claim as is so apps can check if it's been resolved before (null) or still needs to be resolved (undefined)
return claim; if (claimId === null) {
return null;
} else if (claimId === undefined) {
return undefined;
} }
const repostedClaim = claim.reposted_claim; const repostedClaim = claim.reposted_claim;

View file

@ -116,9 +116,12 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true)
if (validUri && byUri) { if (validUri && byUri) {
const claimId = uri && byUri[normalizeURI(uri)]; const claimId = uri && byUri[normalizeURI(uri)];
const claim = byId[claimId]; const claim = byId[claimId];
if (claim === undefined || claim === null) {
// Make sure to return the claim as is so apps can check if it's been resolved before (null) or still needs to be resolved (undefined) // Make sure to return the claim as is so apps can check if it's been resolved before (null) or still needs to be resolved (undefined)
return claim; if (claimId === null) {
return null;
} else if (claimId === undefined) {
return undefined;
} }
const repostedClaim = claim.reposted_claim; const repostedClaim = claim.reposted_claim;
@ -512,7 +515,7 @@ export const selectMyChannelClaims = createSelector(
export const selectMyChannelUrls = createSelector( export const selectMyChannelUrls = createSelector(
selectMyChannelClaims, selectMyChannelClaims,
claims => claims ? claims.map(claim => claim.canonical_url || claim.permanent_url) : undefined claims => (claims ? claims.map(claim => claim.canonical_url || claim.permanent_url) : undefined)
); );
export const selectResolvingUris = createSelector( export const selectResolvingUris = createSelector(