diff --git a/ui/js/actions/file_info.js b/ui/js/actions/file_info.js index b36cb784e..d21df8d2a 100644 --- a/ui/js/actions/file_info.js +++ b/ui/js/actions/file_info.js @@ -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({ - type: types.ABANDON_CLAIM_SUCCEEDED, - data: { - claimId: fileInfo.claim_id, - }, - }); + 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); } } diff --git a/ui/js/reducers/claims.js b/ui/js/reducers/claims.js index adc0eb2ed..9e072f1ce 100644 --- a/ui/js/reducers/claims.js +++ b/ui/js/reducers/claims.js @@ -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;