Fixed redundant storing of states
This commit is contained in:
parent
c4626dda4a
commit
a2791ec57a
2 changed files with 16 additions and 14 deletions
|
@ -45,14 +45,6 @@ reducers[types.FETCH_CLAIM_LIST_MINE_COMPLETED] = function(state, action) {
|
|||
const byId = Object.assign({}, state.byId);
|
||||
const pendingById = Object.assign({}, state.pendingById);
|
||||
const abandoningById = Object.assign({}, state.abandoningById);
|
||||
const allMyClaimsByTxidNout = new Set(
|
||||
claims.map(claim => `${claim.txid}:${claim.nout}`)
|
||||
);
|
||||
const myClaims = new Set(
|
||||
claims
|
||||
.map(claim => claim.claim_id)
|
||||
.filter(claimId => Object.keys(abandoningById).indexOf(claimId) === -1)
|
||||
);
|
||||
|
||||
claims
|
||||
.filter(claim => claim.category && claim.category.match(/claim/))
|
||||
|
@ -80,8 +72,7 @@ reducers[types.FETCH_CLAIM_LIST_MINE_COMPLETED] = function(state, action) {
|
|||
|
||||
return Object.assign({}, state, {
|
||||
isFetchingClaimListMine: false,
|
||||
myClaims: myClaims,
|
||||
allMyClaimsByTxidNout: allMyClaimsByTxidNout,
|
||||
myClaims: claims,
|
||||
byId,
|
||||
pendingById,
|
||||
});
|
||||
|
|
|
@ -121,15 +121,26 @@ export const selectIsFetchingClaimListMine = createSelector(
|
|||
state => !!state.isFetchingClaimListMine
|
||||
);
|
||||
|
||||
export const selectMyClaimsRaw = createSelector(
|
||||
export const cantFigureOutVarName = createSelector(
|
||||
_selectState,
|
||||
state => new Set(state.myClaims)
|
||||
state => state.myClaims
|
||||
);
|
||||
|
||||
export const selectAbandoningIds = createSelector(_selectState, state =>
|
||||
Object.keys(state.abandoningById || {})
|
||||
);
|
||||
|
||||
export const selectMyClaimsRaw = createSelector(
|
||||
cantFigureOutVarName,
|
||||
selectAbandoningIds,
|
||||
(claims, abandoningIds) =>
|
||||
new Set(
|
||||
claims
|
||||
.map(claim => claim.claim_id)
|
||||
.filter(claimId => Object.keys(abandoningIds).indexOf(claimId) === -1)
|
||||
)
|
||||
);
|
||||
|
||||
export const selectPendingClaims = createSelector(_selectState, state =>
|
||||
Object.values(state.pendingById || {})
|
||||
);
|
||||
|
@ -158,8 +169,8 @@ export const selectMyClaimsWithoutChannels = createSelector(
|
|||
);
|
||||
|
||||
export const selectAllMyClaimsByTxidNout = createSelector(
|
||||
_selectState,
|
||||
state => state.allMyClaimsByTxidNout || {}
|
||||
cantFigureOutVarName,
|
||||
claims => new Set(claims.map(claim => `${claim.txid}:${claim.nout}`))
|
||||
);
|
||||
|
||||
export const selectMyClaimsOutpoints = createSelector(
|
||||
|
|
Loading…
Add table
Reference in a new issue