forked from p34709852/monkey
Some unecessary set states removed to prevent refreshing of config page
This commit is contained in:
parent
0513966c76
commit
d67cb18cae
|
@ -29,9 +29,11 @@ class AppComponent extends AuthComponent {
|
|||
updateStatus = () => {
|
||||
this.auth.loggedIn()
|
||||
.then(res => {
|
||||
this.setState({
|
||||
isLoggedIn: res
|
||||
});
|
||||
if (this.state.isLoggedIn !== res) {
|
||||
this.setState({
|
||||
isLoggedIn: res
|
||||
});
|
||||
}
|
||||
|
||||
if (res) {
|
||||
this.authFetch('/api')
|
||||
|
|
|
@ -141,9 +141,12 @@ class ConfigurePageComponent extends AuthComponent {
|
|||
.then(res => res.json())
|
||||
.then(res => {
|
||||
// This check is used to prevent unnecessary re-rendering
|
||||
this.setState({
|
||||
allMonkeysAreDead: (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done'])
|
||||
});
|
||||
let allMonkeysAreDead = (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done']);
|
||||
if (allMonkeysAreDead !== this.state.allMonkeysAreDead) {
|
||||
this.setState({
|
||||
allMonkeysAreDead: allMonkeysAreDead
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue