From 44e66600690057b8f8b53ad1e7d8b0eccc495847 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Tue, 10 Mar 2020 08:49:54 -0300 Subject: [PATCH] [FIX] Consecutive clear cache calls freezing app (#1851) --- app/views/AuthLoadingView.js | 2 +- app/views/SettingsView/index.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/AuthLoadingView.js b/app/views/AuthLoadingView.js index 92a467720..cbc3587e4 100644 --- a/app/views/AuthLoadingView.js +++ b/app/views/AuthLoadingView.js @@ -32,7 +32,7 @@ export default React.memo(withTheme(({ theme, navigation }) => { {text && ( <> - {`${ text }.\n${ I18n.t('Please_wait') }`} + {`${ text }\n${ I18n.t('Please_wait') }`} )} diff --git a/app/views/SettingsView/index.js b/app/views/SettingsView/index.js index 426c91d2c..5df529332 100644 --- a/app/views/SettingsView/index.js +++ b/app/views/SettingsView/index.js @@ -6,7 +6,8 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { SafeAreaView } from 'react-navigation'; -import { logout as logoutAction, loginRequest as loginRequestAction } from '../../actions/login'; +import { logout as logoutAction } from '../../actions/login'; +import { selectServerRequest as selectServerRequestAction } from '../../actions/server'; import { toggleCrashReport as toggleCrashReportAction } from '../../actions/crashReport'; import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors'; import { DrawerButton, CloseModalButton } from '../../containers/HeaderButton'; @@ -81,7 +82,7 @@ class SettingsView extends React.Component { theme: PropTypes.string, split: PropTypes.bool, logout: PropTypes.func.isRequired, - loginRequest: PropTypes.func, + selectServerRequest: PropTypes.func, token: PropTypes.string, appStart: PropTypes.func } @@ -106,11 +107,11 @@ class SettingsView extends React.Component { callToAction: I18n.t('Clear'), onPress: async() => { const { - server: { server }, loginRequest, token, appStart + server: { server }, appStart, selectServerRequest } = this.props; await appStart('loading', I18n.t('Clear_cache_loading')); await RocketChat.clearCache({ server }); - await loginRequest({ resume: token }, true); + await selectServerRequest(server, null, true); } }); } @@ -348,7 +349,7 @@ const mapStateToProps = state => ({ const mapDispatchToProps = dispatch => ({ logout: () => dispatch(logoutAction()), - loginRequest: (...params) => dispatch(loginRequestAction(...params)), + selectServerRequest: params => dispatch(selectServerRequestAction(params)), toggleCrashReport: params => dispatch(toggleCrashReportAction(params)), appStart: (...params) => dispatch(appStartAction(...params)) });