summaryrefslogtreecommitdiff
path: root/public/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/index.js')
-rw-r--r--public/js/index.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 77ab089c..8080b9c7 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2308,11 +2308,9 @@ socket.on('delete', function () {
});
}
});
-var retryOnDisconnect = false;
var retryTimer = null;
socket.on('maintenance', function () {
cmClient.revision = -1;
- retryOnDisconnect = true;
});
socket.on('disconnect', function (data) {
showStatus(statusType.offline);
@@ -2322,7 +2320,7 @@ socket.on('disconnect', function (data) {
}
if (!editor.getOption('readOnly'))
editor.setOption('readOnly', true);
- if (retryOnDisconnect && !retryTimer) {
+ if (!retryTimer) {
retryTimer = setInterval(function () {
if (!needRefresh) socket.connect();
}, 1000);
@@ -2337,7 +2335,6 @@ socket.on('reconnect', function (data) {
socket.on('connect', function (data) {
clearInterval(retryTimer);
retryTimer = null;
- retryOnDisconnect = false;
personalInfo['id'] = socket.id;
showStatus(statusType.connected);
socket.emit('version');
@@ -2651,7 +2648,7 @@ socket.on('doc', function (obj) {
obj = JSON.parse(obj);
var body = obj.str;
var bodyMismatch = editor.getValue() !== body;
- var setDoc = !cmClient || (cmClient && cmClient.revision === -1) || obj.force;
+ var setDoc = !cmClient || (cmClient && (cmClient.revision === -1 || (cmClient.revision !== obj.revision && Object.keys(cmClient.state).length <= 0))) || obj.force;
saveInfo();
if (setDoc && bodyMismatch) {