File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import DevModeLogin from './devmodelogin';
1010const Login : React . FunctionComponent = ( ) => {
1111 const [ deploymentType , setDeploymentType ] = useState < string | 'github' > ( ) ;
1212 const [ isDevModeEnabled , setIsDevModeEnabled ] = useState < boolean > ( false ) ;
13+ const [ isLoading , setIsLoading ] = useState < boolean > ( true ) ;
1314
1415 useEffect ( ( ) => {
1516 const chooseLoginPage = async ( ) => {
@@ -21,16 +22,22 @@ const Login: React.FunctionComponent = () => {
2122 } catch ( error ) {
2223 console . error ( 'Error fetching environment config:' , error ) ;
2324 setDeploymentType ( 'github' ) ;
25+ } finally {
26+ setIsLoading ( false ) ;
2427 }
2528 } ;
2629 chooseLoginPage ( ) ;
2730 } , [ ] ) ;
2831
32+ // Don't render the page until the useEffect finishes fetching environment data
33+ if ( isLoading || deploymentType === null ) {
34+ return < div style = { { color : 'white' , padding : '1rem' } } > Loading...</ div > ;
35+ }
36+
2937 if ( isDevModeEnabled ) {
3038 return < DevModeLogin /> ;
3139 }
3240 if ( deploymentType === 'native' ) {
33- // Render a loading indicator or null while determining the environment
3441 return < NativeLogin /> ;
3542 }
3643 return (
You can’t perform that action at this time.
0 commit comments