mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-10 12:39:44 +00:00
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 byId = Object.assign({}, state.byId);
|
||||||
const pendingById = Object.assign({}, state.pendingById);
|
const pendingById = Object.assign({}, state.pendingById);
|
||||||
const abandoningById = Object.assign({}, state.abandoningById);
|
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
|
claims
|
||||||
.filter(claim => claim.category && claim.category.match(/claim/))
|
.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, {
|
return Object.assign({}, state, {
|
||||||
isFetchingClaimListMine: false,
|
isFetchingClaimListMine: false,
|
||||||
myClaims: myClaims,
|
myClaims: claims,
|
||||||
allMyClaimsByTxidNout: allMyClaimsByTxidNout,
|
|
||||||
byId,
|
byId,
|
||||||
pendingById,
|
pendingById,
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,15 +121,26 @@ export const selectIsFetchingClaimListMine = createSelector(
|
||||||
state => !!state.isFetchingClaimListMine
|
state => !!state.isFetchingClaimListMine
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectMyClaimsRaw = createSelector(
|
export const cantFigureOutVarName = createSelector(
|
||||||
_selectState,
|
_selectState,
|
||||||
state => new Set(state.myClaims)
|
state => state.myClaims
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectAbandoningIds = createSelector(_selectState, state =>
|
export const selectAbandoningIds = createSelector(_selectState, state =>
|
||||||
Object.keys(state.abandoningById || {})
|
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 =>
|
export const selectPendingClaims = createSelector(_selectState, state =>
|
||||||
Object.values(state.pendingById || {})
|
Object.values(state.pendingById || {})
|
||||||
);
|
);
|
||||||
|
@ -158,8 +169,8 @@ export const selectMyClaimsWithoutChannels = createSelector(
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectAllMyClaimsByTxidNout = createSelector(
|
export const selectAllMyClaimsByTxidNout = createSelector(
|
||||||
_selectState,
|
cantFigureOutVarName,
|
||||||
state => state.allMyClaimsByTxidNout || {}
|
claims => new Set(claims.map(claim => `${claim.txid}:${claim.nout}`))
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectMyClaimsOutpoints = createSelector(
|
export const selectMyClaimsOutpoints = createSelector(
|
||||||
|
|
Loading…
Add table
Reference in a new issue