import React , { useEffect } from 'react' ; import { useHistory } from 'react-router-dom' ; import { useHasData } from '../../hooks/use_has_data' ; import { LoadingObservability } from '../overview/loading_observability' ; export function HomePage ( ) { const history = useHistory ( ) ; const { hasAnyData , isAllRequestsComplete } = useHasData ( ) ; useEffect ( ( ) => { if ( hasAnyData === true ) { history . replace ( { pathname : '/overview' } ) ; } else if ( hasAnyData === false && isAllRequestsComplete === true ) { history . replace ( { pathname : '/landing' } ) ; } } , [ hasAnyData , isAllRequestsComplete , history ] ) ; return < LoadingObservability />; }