1
- import React , { ReactElement } from 'react'
1
+ import React , { ReactElement , useEffect } from 'react'
2
2
import { Provider , useSelector } from 'react-redux'
3
3
import { EuiPage , EuiPageBody } from '@elastic/eui'
4
4
5
5
import { Route , Switch } from 'react-router-dom'
6
6
import { store } from 'uiSrc/slices/store'
7
7
import { appInfoSelector } from 'uiSrc/slices/app/info'
8
- import { PagePlaceholder } from 'uiSrc/components '
8
+ import { removePagePlaceholder } from 'uiSrc/utils '
9
9
import MonacoLanguages from 'uiSrc/components/monaco-laguages'
10
10
import AppInit from 'uiSrc/components/init/AppInit'
11
11
import { Pages , Theme } from './constants'
@@ -40,6 +40,11 @@ const AppWrapper = ({ children }: { children?: ReactElement[] }) => (
40
40
)
41
41
const App = ( { children } : { children ?: ReactElement [ ] } ) => {
42
42
const { loading : serverLoading } = useSelector ( appInfoSelector )
43
+ useEffect ( ( ) => {
44
+ if ( ! serverLoading ) {
45
+ removePagePlaceholder ( )
46
+ }
47
+ } , [ serverLoading ] )
43
48
return (
44
49
< div className = "main-container" >
45
50
< ThemeComponent />
@@ -54,18 +59,14 @@ const App = ({ children }: { children?: ReactElement[] }) => {
54
59
path = "*"
55
60
render = { ( ) => (
56
61
< >
57
- { serverLoading
58
- ? < PagePlaceholder />
59
- : (
60
- < EuiPage className = "main" >
61
- < GlobalDialogs />
62
- < GlobalSubscriptions />
63
- < NavigationMenu />
64
- < EuiPageBody component = "main" >
65
- < MainComponent />
66
- </ EuiPageBody >
67
- </ EuiPage >
68
- ) }
62
+ < EuiPage className = "main" >
63
+ < GlobalDialogs />
64
+ < GlobalSubscriptions />
65
+ < NavigationMenu />
66
+ < EuiPageBody component = "main" >
67
+ < MainComponent />
68
+ </ EuiPageBody >
69
+ </ EuiPage >
69
70
< Notifications />
70
71
< Config />
71
72
< ShortcutsFlyout />
0 commit comments