From 67e7a822e84789e8c22f9f6808f23f43226d7d04 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 30 Mar 2021 17:08:45 -0400 Subject: [PATCH] collab_client: Treat RECONNECTING the same as CONNECTING --- src/static/js/collab_client.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index a449b02d6..4e0f773fc 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -80,8 +80,9 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad) return; } const now = Date.now(); - if ((!getSocket()) || channelState === 'CONNECTING') { - if (channelState === 'CONNECTING' && now - startConnectTime > 20000) { + const connecting = ['CONNECTING', 'RECONNECTING'].includes(channelState); + if (!getSocket() || connecting) { + if (connecting && now - startConnectTime > 20000) { setChannelState('DISCONNECTED', 'initsocketfail'); } else { // check again in a bit @@ -355,6 +356,7 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad) callbacks.onChannelStateChange(channelState, moreInfo); switch (channelState) { case 'CONNECTING': + case 'RECONNECTING': startConnectTime = Date.now(); break; case 'CONNECTED':