Merge "web: prevent status update loop in background"

This commit is contained in:
Zuul 2019-02-18 18:18:33 +00:00 committed by Gerrit Code Review
commit 91fb92978e
1 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,7 @@ class StatusPage extends Refreshable {
updateData = (force) => {
if (force || (this.visible && this.state.autoReload)) {
this.props.dispatch(fetchStatusIfNeeded(this.props.tenant))
.then(() => {if (this.state.autoReload) {
.then(() => {if (this.state.autoReload && this.visible) {
this.timer = setTimeout(this.updateData, 5000)
}})
}
@ -106,6 +106,7 @@ class StatusPage extends Refreshable {
clearTimeout(this.timer)
this.timer = null
}
this.visible = false
document.removeEventListener(
this.visibilityChangeEvent, this.visibilityListener)
}