diff --git a/app/views/NewServerView/index.tsx b/app/views/NewServerView/index.tsx index 67d7f6b68..9ab2fa78d 100644 --- a/app/views/NewServerView/index.tsx +++ b/app/views/NewServerView/index.tsx @@ -14,7 +14,7 @@ import Button from '../../containers/Button'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; import * as HeaderButton from '../../containers/HeaderButton'; import OrSeparator from '../../containers/OrSeparator'; -import { IBaseScreen, TServerHistoryModel } from '../../definitions'; +import { IApplicationState, IBaseScreen, TServerHistoryModel } from '../../definitions'; import { withDimensions } from '../../dimensions'; import I18n from '../../i18n'; import database from '../../lib/database'; @@ -67,7 +67,7 @@ const styles = StyleSheet.create({ interface INewServerViewProps extends IBaseScreen { connecting: boolean; - previousServer: string; + previousServer: string | null; width: number; height: number; } @@ -75,7 +75,7 @@ interface INewServerViewProps extends IBaseScreen { const { dispatch, previousServer } = this.props; dispatch(inviteLinksClear()); - dispatch(selectServerRequest(previousServer)); + if (previousServer) { + dispatch(selectServerRequest(previousServer)); + } }; handleNewServerEvent = (event: { server: string }) => { @@ -265,8 +267,7 @@ class NewServerView extends React.Component this.setState({ certificate: null }) // We not need delete file from DocumentPicker because it is a temp file }); }; @@ -405,7 +406,7 @@ class NewServerView extends React.Component ({ +const mapStateToProps = (state: IApplicationState) => ({ connecting: state.server.connecting, previousServer: state.server.previousServer });