Browse Source

don't spam dashboard check

master
Gaëtan Renaudeau 7 years ago
parent
commit
85f84688f3
  1. 9
      src/components/Workflow/EnsureDashboard.js

9
src/components/Workflow/EnsureDashboard.js

@ -42,21 +42,20 @@ class EnsureDashboard extends PureComponent<Props, State> {
componentDidMount() { componentDidMount() {
this.checkForDashboard() this.checkForDashboard()
this._interval = setInterval(this.checkForDashboard, 1000)
} }
componentDidUpdate() { componentDidUpdate({ device }: Props) {
this.checkForDashboard() if (this.props.device !== device && this.props.device) {
this.checkForDashboard()
}
} }
componentWillUnmount() { componentWillUnmount() {
this._unmounting = true this._unmounting = true
clearInterval(this._interval)
} }
_checking = false _checking = false
_unmounting = false _unmounting = false
_interval: *
checkForDashboard = async () => { checkForDashboard = async () => {
const { device } = this.props const { device } = this.props

Loading…
Cancel
Save