Cleaner way of filtering published claims while abandoning
This commit is contained in:
parent
d0e3dd8f99
commit
f1c45775ab
2 changed files with 11 additions and 15 deletions
|
@ -102,20 +102,12 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
|||
},
|
||||
});
|
||||
|
||||
// We need to run this after a few seconds or the claim gets added back
|
||||
// to the store again by an already running fetch claims query.
|
||||
const success = setTimeout(
|
||||
() => {
|
||||
dispatch({
|
||||
const success = dispatch({
|
||||
type: types.ABANDON_CLAIM_SUCCEEDED,
|
||||
data: {
|
||||
claimId: fileInfo.claim_id,
|
||||
},
|
||||
});
|
||||
},
|
||||
10000,
|
||||
{ once: true }
|
||||
);
|
||||
lbry.claim_abandon({ claim_id: fileInfo.claim_id }).then(success);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,12 @@ reducers[types.FETCH_CLAIM_LIST_MINE_COMPLETED] = function(state, action) {
|
|||
const byUri = Object.assign({}, state.claimsByUri);
|
||||
const byId = Object.assign({}, state.byId);
|
||||
const pendingById = Object.assign({}, state.pendingById);
|
||||
|
||||
const myClaims = new Set(claims.map(claim => claim.claim_id));
|
||||
const abandoningById = Object.assign({}, state.abandoningById);
|
||||
const myClaims = new Set(
|
||||
claims
|
||||
.map(claim => claim.claim_id)
|
||||
.filter(claimId => Object.keys(abandoningById).indexOf(claimId) === -1)
|
||||
);
|
||||
|
||||
claims.forEach(claim => {
|
||||
byId[claim.claim_id] = claim;
|
||||
|
|
Loading…
Reference in a new issue