Remove abandoned claim from Uploads Page (#7534)
## Issue In Uploads Page, Claim doesn't go away immediately when deleted, only after a refresh. ## Approach - Also update `myClaimsPageResults` when abandoning. - `abandonedUris` is an array because the uris come in various form, so had to check all. (Cherry-pick of Odysee PR_1276)
This commit is contained in:
parent
daab8a28ed
commit
21204321c0
1 changed files with 9 additions and 0 deletions
|
@ -532,17 +532,25 @@ reducers[ACTIONS.ABANDON_CLAIM_SUCCEEDED] = (state: State, action: any): State =
|
||||||
const { claimId }: { claimId: string } = action.data;
|
const { claimId }: { claimId: string } = action.data;
|
||||||
const byId = Object.assign({}, state.byId);
|
const byId = Object.assign({}, state.byId);
|
||||||
const newMyClaims = state.myClaims ? state.myClaims.slice() : [];
|
const newMyClaims = state.myClaims ? state.myClaims.slice() : [];
|
||||||
|
let myClaimsPageResults = null;
|
||||||
const newMyChannelClaims = state.myChannelClaims ? state.myChannelClaims.slice() : [];
|
const newMyChannelClaims = state.myChannelClaims ? state.myChannelClaims.slice() : [];
|
||||||
const claimsByUri = Object.assign({}, state.claimsByUri);
|
const claimsByUri = Object.assign({}, state.claimsByUri);
|
||||||
const abandoningById = Object.assign({}, state.abandoningById);
|
const abandoningById = Object.assign({}, state.abandoningById);
|
||||||
const newMyCollectionClaims = state.myCollectionClaims ? state.myCollectionClaims.slice() : [];
|
const newMyCollectionClaims = state.myCollectionClaims ? state.myCollectionClaims.slice() : [];
|
||||||
|
|
||||||
|
let abandonedUris = [];
|
||||||
|
|
||||||
Object.keys(claimsByUri).forEach((uri) => {
|
Object.keys(claimsByUri).forEach((uri) => {
|
||||||
if (claimsByUri[uri] === claimId) {
|
if (claimsByUri[uri] === claimId) {
|
||||||
|
abandonedUris.push(uri);
|
||||||
delete claimsByUri[uri];
|
delete claimsByUri[uri];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (abandonedUris.length > 0 && state.myClaimsPageResults) {
|
||||||
|
myClaimsPageResults = state.myClaimsPageResults.filter((uri) => !abandonedUris.includes(uri));
|
||||||
|
}
|
||||||
|
|
||||||
if (abandoningById[claimId]) {
|
if (abandoningById[claimId]) {
|
||||||
delete abandoningById[claimId];
|
delete abandoningById[claimId];
|
||||||
}
|
}
|
||||||
|
@ -560,6 +568,7 @@ reducers[ACTIONS.ABANDON_CLAIM_SUCCEEDED] = (state: State, action: any): State =
|
||||||
byId,
|
byId,
|
||||||
claimsByUri,
|
claimsByUri,
|
||||||
abandoningById,
|
abandoningById,
|
||||||
|
myClaimsPageResults: myClaimsPageResults || state.myClaimsPageResults,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue