From 07bfa3859d93706f35bbb5267ad10c2ec324c5ae Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Thu, 2 Jul 2020 06:52:36 +0200 Subject: [PATCH] Fixes blank page on rewards Resolves https://github.com/brave/brave-browser/issues/10542 --- .../resources/android_page/reducers/publishers_reducer.ts | 4 ++-- components/brave_rewards/resources/android_page/utils.ts | 2 +- .../resources/page/reducers/publishers_reducer.ts | 4 ++-- components/brave_rewards/resources/page/utils.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/brave_rewards/resources/android_page/reducers/publishers_reducer.ts b/components/brave_rewards/resources/android_page/reducers/publishers_reducer.ts index e74b1d583255..c082310e3fc6 100644 --- a/components/brave_rewards/resources/android_page/reducers/publishers_reducer.ts +++ b/components/brave_rewards/resources/android_page/reducers/publishers_reducer.ts @@ -57,7 +57,7 @@ const publishersReducer: Reducer = (state: Rewards.St } else { state.recurringLoad = true } - state.recurringList = action.payload.list + state.recurringList = action.payload.list || [] break case types.REMOVE_RECURRING_TIP: if (!action.payload.publisherKey) { @@ -72,7 +72,7 @@ const publishersReducer: Reducer = (state: Rewards.St } else { state.tipsLoad = true } - state.tipsList = action.payload.list + state.tipsList = action.payload.list || [] break case types.ON_RECURRING_TIP_SAVED: case types.ON_RECURRING_TIP_REMOVED: diff --git a/components/brave_rewards/resources/android_page/utils.ts b/components/brave_rewards/resources/android_page/utils.ts index c0e6e10f41df..81353f4fbc75 100644 --- a/components/brave_rewards/resources/android_page/utils.ts +++ b/components/brave_rewards/resources/android_page/utils.ts @@ -39,7 +39,7 @@ export const generateContributionMonthly = (properties: Rewards.RewardsParameter } export const tipsListTotal = (list: Rewards.Publisher[]) => { - if (list.length === 0) { + if (!list || list.length === 0) { return 0.0 } diff --git a/components/brave_rewards/resources/page/reducers/publishers_reducer.ts b/components/brave_rewards/resources/page/reducers/publishers_reducer.ts index 09d6fc6cf85b..b93673b41d53 100644 --- a/components/brave_rewards/resources/page/reducers/publishers_reducer.ts +++ b/components/brave_rewards/resources/page/reducers/publishers_reducer.ts @@ -57,7 +57,7 @@ const publishersReducer: Reducer = (state: Rewards.St } else { state.recurringLoad = true } - state.recurringList = action.payload.list + state.recurringList = action.payload.list || [] break case types.REMOVE_RECURRING_TIP: if (!action.payload.publisherKey) { @@ -72,7 +72,7 @@ const publishersReducer: Reducer = (state: Rewards.St } else { state.tipsLoad = true } - state.tipsList = action.payload.list + state.tipsList = action.payload.list || [] break case types.ON_RECURRING_TIP_SAVED: case types.ON_RECURRING_TIP_REMOVED: diff --git a/components/brave_rewards/resources/page/utils.ts b/components/brave_rewards/resources/page/utils.ts index c0e6e10f41df..81353f4fbc75 100644 --- a/components/brave_rewards/resources/page/utils.ts +++ b/components/brave_rewards/resources/page/utils.ts @@ -39,7 +39,7 @@ export const generateContributionMonthly = (properties: Rewards.RewardsParameter } export const tipsListTotal = (list: Rewards.Publisher[]) => { - if (list.length === 0) { + if (!list || list.length === 0) { return 0.0 }