mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-30 00:41:24 +00:00
use splice to remove reward; force update in newState data
This commit is contained in:
parent
186c437955
commit
cb85b633f7
1 changed files with 4 additions and 4 deletions
|
@ -62,18 +62,18 @@ reducers[ACTIONS.CLAIM_REWARD_STARTED] = (state, action) => {
|
||||||
|
|
||||||
reducers[ACTIONS.CLAIM_REWARD_SUCCESS] = (state, action) => {
|
reducers[ACTIONS.CLAIM_REWARD_SUCCESS] = (state, action) => {
|
||||||
const { reward } = action.data;
|
const { reward } = action.data;
|
||||||
let { unclaimedRewards } = state;
|
const { unclaimedRewards } = state;
|
||||||
|
|
||||||
const index = unclaimedRewards.findIndex(ur => ur.reward_type === reward.reward_type);
|
const index = unclaimedRewards.findIndex(ur => ur.reward_type === reward.reward_type);
|
||||||
unclaimedRewards = unclaimedRewards.slice(0, index).concat(unclaimedRewards.slice(index + 1));
|
unclaimedRewards.splice(index, 1);
|
||||||
|
|
||||||
const { claimedRewardsById } = state;
|
const { claimedRewardsById } = state;
|
||||||
claimedRewardsById[reward.id] = reward;
|
claimedRewardsById[reward.id] = reward;
|
||||||
|
|
||||||
const newState = {
|
const newState = {
|
||||||
...state,
|
...state,
|
||||||
unclaimedRewards,
|
unclaimedRewards: [...unclaimedRewards],
|
||||||
claimedRewardsById,
|
claimedRewardsById: { ...claimedRewardsById },
|
||||||
};
|
};
|
||||||
|
|
||||||
return setClaimRewardState(newState, reward, false, '');
|
return setClaimRewardState(newState, reward, false, '');
|
||||||
|
|
Loading…
Add table
Reference in a new issue