mirror of https://github.com/vector-im/riot-web
Don't rely on React being fast
parent
c6a18b11f0
commit
2bc0e8e151
|
@ -149,6 +149,7 @@ module.exports = React.createClass({
|
||||||
if (!this.state.serverIsAlive) {
|
if (!this.state.serverIsAlive) {
|
||||||
this.setState({busy: true});
|
this.setState({busy: true});
|
||||||
// Do a quick liveliness check on the URLs
|
// Do a quick liveliness check on the URLs
|
||||||
|
let aliveAgain = true;
|
||||||
try {
|
try {
|
||||||
await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(
|
await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(
|
||||||
this.props.serverConfig.hsUrl,
|
this.props.serverConfig.hsUrl,
|
||||||
|
@ -156,17 +157,16 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
this.setState({serverIsAlive: true, errorText: ""});
|
this.setState({serverIsAlive: true, errorText: ""});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
const componentState = AutoDiscoveryUtils.authComponentStateForError(e);
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: false,
|
busy: false,
|
||||||
...AutoDiscoveryUtils.authComponentStateForError(e),
|
...componentState,
|
||||||
});
|
});
|
||||||
if (this.state.serverErrorIsFatal) {
|
aliveAgain = !componentState.serverErrorIsFatal;
|
||||||
return; // Server is dead - do not continue.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent people from submitting their password when something isn't right.
|
// Prevent people from submitting their password when something isn't right.
|
||||||
if (!this.state.serverIsAlive) {
|
if (!aliveAgain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue