From cb85b633f770b5d73aad1ee16f1379d21f05260e Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Wed, 30 May 2018 12:09:01 -0400 Subject: [PATCH] use splice to remove reward; force update in newState data --- src/renderer/redux/reducers/rewards.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/redux/reducers/rewards.js b/src/renderer/redux/reducers/rewards.js index a448ca051..67f861e6c 100644 --- a/src/renderer/redux/reducers/rewards.js +++ b/src/renderer/redux/reducers/rewards.js @@ -62,18 +62,18 @@ reducers[ACTIONS.CLAIM_REWARD_STARTED] = (state, action) => { reducers[ACTIONS.CLAIM_REWARD_SUCCESS] = (state, action) => { const { reward } = action.data; - let { unclaimedRewards } = state; + const { unclaimedRewards } = state; 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; claimedRewardsById[reward.id] = reward; const newState = { ...state, - unclaimedRewards, - claimedRewardsById, + unclaimedRewards: [...unclaimedRewards], + claimedRewardsById: { ...claimedRewardsById }, }; return setClaimRewardState(newState, reward, false, '');