From ad478f83935d2a1b36606b5a354ddc1358fd16c3 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 5 Nov 2020 12:41:56 -0330 Subject: [PATCH] Remove unreachable branches from first time flow switch (#9795) The conditions `isUnlocked` and `!isUnlocked` did account for all cases, so any branches after that were unreachable. --- .../first-time-flow-switch.component.js | 19 ++----------------- .../first-time-flow-switch.container.js | 8 +------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js b/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js index 9a147c1c0..54503bf1d 100644 --- a/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js +++ b/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.component.js @@ -6,7 +6,6 @@ import { LOCK_ROUTE, INITIALIZE_WELCOME_ROUTE, INITIALIZE_UNLOCK_ROUTE, - INITIALIZE_METAMETRICS_OPT_IN_ROUTE, } from '../../../helpers/constants/routes' export default class FirstTimeFlowSwitch extends PureComponent { @@ -14,16 +13,10 @@ export default class FirstTimeFlowSwitch extends PureComponent { completedOnboarding: PropTypes.bool, isInitialized: PropTypes.bool, isUnlocked: PropTypes.bool, - optInMetaMetrics: PropTypes.bool, } render() { - const { - completedOnboarding, - isInitialized, - isUnlocked, - optInMetaMetrics, - } = this.props + const { completedOnboarding, isInitialized, isUnlocked } = this.props if (completedOnboarding) { return @@ -37,14 +30,6 @@ export default class FirstTimeFlowSwitch extends PureComponent { return } - if (!isUnlocked) { - return - } - - if (optInMetaMetrics === null) { - return - } - - return + return } } diff --git a/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.container.js b/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.container.js index d68f7a153..1b35418b5 100644 --- a/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.container.js +++ b/ui/app/pages/first-time-flow/first-time-flow-switch/first-time-flow-switch.container.js @@ -2,18 +2,12 @@ import { connect } from 'react-redux' import FirstTimeFlowSwitch from './first-time-flow-switch.component' const mapStateToProps = ({ metamask }) => { - const { - completedOnboarding, - isInitialized, - isUnlocked, - participateInMetaMetrics: optInMetaMetrics, - } = metamask + const { completedOnboarding, isInitialized, isUnlocked } = metamask return { completedOnboarding, isInitialized, isUnlocked, - optInMetaMetrics, } }