diff --git a/components/brave_rewards/resources/ui/components/settingsPage.tsx b/components/brave_rewards/resources/ui/components/settingsPage.tsx index d30304fe362a..387727b6b50b 100644 --- a/components/brave_rewards/resources/ui/components/settingsPage.tsx +++ b/components/brave_rewards/resources/ui/components/settingsPage.tsx @@ -32,6 +32,14 @@ class SettingsPage extends React.Component { return this.props.actions } + refreshActions () { + this.actions.getCurrentReport() + this.actions.getDonationTable() + this.actions.getContributeList() + this.actions.getPendingContributionsTotal() + this.actions.getReconcileStamp() + } + componentDidMount () { if (this.props.rewardsData.firstLoad === null) { // First load ever @@ -47,14 +55,10 @@ class SettingsPage extends React.Component { this.actions.getWalletProperties() }, 60000) - this.actions.getCurrentReport() - this.actions.getDonationTable() - this.actions.getContributeList() + this.refreshActions() this.actions.getAdsData() this.actions.checkImported() - this.actions.getReconcileStamp() this.actions.getGrant() - this.actions.getPendingContributionsTotal() // one time check (legacy fix) // more info here https://github.com/brave/brave-browser/issues/2172 @@ -63,6 +67,23 @@ class SettingsPage extends React.Component { } } + componentDidUpdate (prevProps: Props) { + if ( + !prevProps.rewardsData.enabledMain && + this.props.rewardsData.enabledMain + ) { + this.refreshActions() + } + + if ( + !prevProps.rewardsData.enabledContribute && + this.props.rewardsData.enabledContribute + ) { + this.actions.getContributeList() + this.actions.getReconcileStamp() + } + } + componentWillUnmount () { clearInterval(this.balanceTimerId) }