clear reconnect timer on new connection

This commit is contained in:
or-else
2021-04-28 17:05:00 -07:00
parent 7adc06332e
commit 273e34de2c
5 changed files with 11 additions and 3 deletions
+5
View File
@@ -285,6 +285,7 @@ class TinodeWeb extends React.Component {
window.removeEventListener('resize', this.handleResize);
window.removeEventListener('hashchange', this.handleHashRoute);
document.removeEventListener('visibilitychange', this.handleVisibilityEvent);
clearInterval(this.reconnectCountdown);
}
// Setup transport (usually websocket) and server address. This will terminate connection with the server.
@@ -453,6 +454,10 @@ class TinodeWeb extends React.Component {
// Connection succeeded.
handleConnected() {
// Just to be sure.
clearInterval(this.reconnectCountdown);
this.handleError();
const params = this.tinode.getServerInfo();
this.setState({
serverVersion: params.ver + ' ' + (params.build ? params.build : 'none')