Assume weekly_watch is claimed when data is insufficient (#1806)
## Issue If the reward-list fetch is slow, the selector assumes the weekly_watch hasn't been claimed yet, causing an unnecessary claim. ## Change The selector now tells the caller if there is no data -- up to caller on what to do (in this case, don't claim the reward). It should be harmless if the claim action was missed, since the user can still manually claim it.
This commit is contained in:
parent
e073e120a1
commit
da691f286e
2 changed files with 2 additions and 2 deletions
|
@ -144,7 +144,7 @@ export function doClaimEligiblePurchaseRewards() {
|
|||
if (unclaimedRewards.find((ur) => ur.reward_type === rewards.TYPE_FIRST_STREAM)) {
|
||||
dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM));
|
||||
} else {
|
||||
if (!selectWeeklyWatchClaimedThisWeek(state)) {
|
||||
if (selectWeeklyWatchClaimedThisWeek(state) === false) {
|
||||
dispatch(doClaimRewardType(rewards.TYPE_WEEKLY_WATCH, { failSilently: true }));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ export const selectWeeklyWatchClaimedThisWeek = createSelector(selectUnclaimedRe
|
|||
const diffDays = diff / (1000 * 60 * 60 * 24);
|
||||
return diffDays < 6.5;
|
||||
}
|
||||
return false;
|
||||
return undefined;
|
||||
});
|
||||
|
||||
export const selectIsRewardApproved = createSelector(selectUser, (user) => user && user.is_reward_approved);
|
||||
|
|
Loading…
Reference in a new issue