Sfoglia il codice sorgente

Fix page load stuck at "Checking Permissions..."

When loading an admin page (Projects, Users, Users Details etc.) by
browser refresh (F5), the page might have been stuck at "Checking
Permissions...". Going to those pages from the Coriolis UI main menu
worked as expected.
Sergiu Miclea 6 anni fa
parent
commit
afafd2d523
1 ha cambiato i file con 1 aggiunte e 15 eliminazioni
  1. 1 15
      src/components/App.jsx

+ 1 - 15
src/components/App.jsx

@@ -47,7 +47,6 @@ import { navigationMenu } from '../constants'
 import Palette from './styleUtils/Palette'
 import Palette from './styleUtils/Palette'
 import StyleProps from './styleUtils/StyleProps'
 import StyleProps from './styleUtils/StyleProps'
 import configLoader from '../utils/Config'
 import configLoader from '../utils/Config'
-import ObjectUtils from '../utils/ObjectUtils'
 
 
 injectGlobal`
 injectGlobal`
   ${Fonts}
   ${Fonts}
@@ -80,7 +79,6 @@ const Wrapper = styled.div`
 type State = {
 type State = {
   isConfigReady: boolean,
   isConfigReady: boolean,
 }
 }
-const MIN_WAIT_MS = 0
 
 
 class App extends React.Component<{}, State> {
 class App extends React.Component<{}, State> {
   state = {
   state = {
@@ -89,24 +87,12 @@ class App extends React.Component<{}, State> {
   awaitingRefresh: boolean = false
   awaitingRefresh: boolean = false
 
 
   async componentWillMount() {
   async componentWillMount() {
-    let startTime = new Date().getTime()
-    observe(userStore, 'loggedUser', () => { this.refreshState(startTime) })
+    observe(userStore, 'loggedUser', () => { this.setState({}) })
     await configLoader.load()
     await configLoader.load()
     userStore.tokenLogin()
     userStore.tokenLogin()
     this.setState({ isConfigReady: true })
     this.setState({ isConfigReady: true })
   }
   }
 
 
-  async refreshState(startTime: number) {
-    if (this.awaitingRefresh) {
-      return
-    }
-    this.awaitingRefresh = true
-    if (new Date().getTime() - startTime < MIN_WAIT_MS) {
-      await ObjectUtils.wait(MIN_WAIT_MS)
-    }
-    this.setState({})
-  }
-
   render() {
   render() {
     if (!this.state.isConfigReady) {
     if (!this.state.isConfigReady) {
       return null
       return null