forked from p15670423/monkey
Merge pull request #266 from guardicore/hotfix/remove-unecessary-set-state
Some unecessary set states removed to prevent refreshing of config page
This commit is contained in:
commit
ee7c9d9ea8
|
@ -29,9 +29,11 @@ class AppComponent extends AuthComponent {
|
||||||
updateStatus = () => {
|
updateStatus = () => {
|
||||||
this.auth.loggedIn()
|
this.auth.loggedIn()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.setState({
|
if (this.state.isLoggedIn !== res) {
|
||||||
isLoggedIn: res
|
this.setState({
|
||||||
});
|
isLoggedIn: res
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
this.authFetch('/api')
|
this.authFetch('/api')
|
||||||
|
|
|
@ -141,9 +141,12 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// This check is used to prevent unnecessary re-rendering
|
// This check is used to prevent unnecessary re-rendering
|
||||||
this.setState({
|
let allMonkeysAreDead = (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done']);
|
||||||
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