11// Libraries
22import React , { ReactElement , PureComponent , Suspense , lazy } from 'react'
3+ import { connect , ConnectedProps } from 'react-redux'
34import { Switch , Route , RouteComponentProps } from 'react-router-dom'
45
56// APIs
67import { getSetup } from 'src/client'
78
89// Components
910import { ErrorHandling } from 'src/shared/decorators/errors'
11+ import { getPublicFlags } from 'src/shared/thunks/flags'
1012import PageSpinner from 'src/perf/components/PageSpinner'
1113import { CloudLoginPage } from 'src/onboarding/containers/CloudLoginPage'
1214// lazy loading the Authenticate component causes wasm issues
@@ -26,6 +28,7 @@ import {isOnboardingURL} from 'src/onboarding/utils'
2628
2729// Types
2830import { RemoteDataState } from 'src/types'
31+ import { CLOUD } from 'src/shared/constants'
2932
3033interface State {
3134 loading : RemoteDataState
@@ -36,10 +39,11 @@ interface OwnProps {
3639 children : ReactElement < any >
3740}
3841
39- type Props = RouteComponentProps & OwnProps
42+ type ReduxProps = ConnectedProps < typeof connector >
43+ type Props = OwnProps & RouteComponentProps & ReduxProps
4044
4145@ErrorHandling
42- export class Setup extends PureComponent < Props , State > {
46+ export class SetupUnconnected extends PureComponent < Props , State > {
4347 constructor ( props : Props ) {
4448 super ( props )
4549
@@ -52,6 +56,10 @@ export class Setup extends PureComponent<Props, State> {
5256 public async componentDidMount ( ) {
5357 const { history} = this . props
5458
59+ if ( CLOUD ) {
60+ await this . props . getPublicFlags ( )
61+ }
62+
5563 if ( isOnboardingURL ( ) ) {
5664 this . setState ( {
5765 loading : RemoteDataState . Done ,
@@ -126,4 +134,10 @@ export class Setup extends PureComponent<Props, State> {
126134 }
127135}
128136
129- export default Setup
137+ const mdtp = {
138+ getPublicFlags : getPublicFlags ,
139+ }
140+
141+ const connector = connect ( null , mdtp )
142+
143+ export const Setup = connector ( SetupUnconnected )
0 commit comments