Skip to content

Commit a70cd0b

Browse files
fix: Fetch FFs on login page (#6171)
* fix: Fetch FFs on login page * chore: prettier Co-authored-by: Dustin Eaton <deaton@influxdata.com>
1 parent 5db143b commit a70cd0b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/Setup.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// Libraries
22
import React, {ReactElement, PureComponent, Suspense, lazy} from 'react'
3+
import {connect, ConnectedProps} from 'react-redux'
34
import {Switch, Route, RouteComponentProps} from 'react-router-dom'
45

56
// APIs
67
import {getSetup} from 'src/client'
78

89
// Components
910
import {ErrorHandling} from 'src/shared/decorators/errors'
11+
import {getPublicFlags} from 'src/shared/thunks/flags'
1012
import PageSpinner from 'src/perf/components/PageSpinner'
1113
import {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
2830
import {RemoteDataState} from 'src/types'
31+
import {CLOUD} from 'src/shared/constants'
2932

3033
interface 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)

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {getStore} from 'src/store/configureStore'
1313
import {history} from 'src/store/history'
1414

1515
// Components
16-
import Setup from 'src/Setup'
16+
import {Setup} from 'src/Setup'
1717
import PageSpinner from 'src/perf/components/PageSpinner'
1818

1919
// Utilities

0 commit comments

Comments
 (0)