diff --git a/src/routes/index.js b/src/routes/index.js index 0786dd82..39f9a0a5 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -1,8 +1,9 @@ // @flow -import React from 'react' +import React, { useState } from 'react' import { connect } from 'react-redux' import { Switch, Redirect, Route } from 'react-router-dom' import { defaultSafeSelector } from '~/routes/safeList/store/selectors' +import Loader from '~/components/Loader' import Welcome from './welcome/container' import { SAFELIST_ADDRESS, @@ -29,29 +30,40 @@ type RoutesProps = { defaultSafe?: string, } -const Routes = ({ defaultSafe }: RoutesProps) => ( - - { - if (typeof defaultSafe === 'undefined') { - return 'Loading...' - } - if (defaultSafe) { - return - } - return - }} - /> - - - - - - - -) +const Routes = ({ defaultSafe }: RoutesProps) => { + const [isInitialLoad, setIniitialLoad] = useState(true) + + return ( + + { + if (!isInitialLoad) { + return + } + + if (typeof defaultSafe === 'undefined') { + return + } + + setIniitialLoad(false) + if (defaultSafe) { + return + } + + return + }} + /> + + + + + + + + ) +} export default connect( // $FlowFixMe