Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Don't rely on React being fast
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Jul 15, 2019
1 parent c6a18b1 commit 2bc0e8e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/structures/auth/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,24 @@ module.exports = React.createClass({
if (!this.state.serverIsAlive) {
this.setState({busy: true});
// Do a quick liveliness check on the URLs
let aliveAgain = true;
try {
await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(
this.props.serverConfig.hsUrl,
this.props.serverConfig.isUrl,
);
this.setState({serverIsAlive: true, errorText: ""});
} catch (e) {
const componentState = AutoDiscoveryUtils.authComponentStateForError(e);
this.setState({
busy: false,
...AutoDiscoveryUtils.authComponentStateForError(e),
...componentState,
});
if (this.state.serverErrorIsFatal) {
return; // Server is dead - do not continue.
}
aliveAgain = !componentState.serverErrorIsFatal;
}

// Prevent people from submitting their password when something isn't right.
if (!this.state.serverIsAlive) {
if (!aliveAgain) {
return;
}
}
Expand Down

0 comments on commit 2bc0e8e

Please sign in to comment.