summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-11-03 14:04:53 +0800
committerWu Cheng-Han2016-11-03 14:04:53 +0800
commit734d475c0e2dc467a657d350d8a37ec8aa800da7 (patch)
tree26198ac74e399c7d7681636845fb1c8b80c69d13
parente42770904267707f01a73c766b2a5c2682a2c059 (diff)
Fix server reconnect might not resend pending operations
-rw-r--r--public/js/index.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 8080b9c7..bb2a31f6 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2648,7 +2648,8 @@ 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 || (cmClient.revision !== obj.revision && Object.keys(cmClient.state).length <= 0))) || obj.force;
+ var havePendingOperation = cmClient && Object.keys(cmClient.state).length > 0;
+ var setDoc = !cmClient || (cmClient && (cmClient.revision === -1 || (cmClient.revision !== obj.revision && !havePendingOperation))) || obj.force;
saveInfo();
if (setDoc && bodyMismatch) {
@@ -2682,6 +2683,8 @@ socket.on('doc', function (obj) {
cmClient.setState(new ot.Client.Synchronized());
cmClient.initializeClientList();
cmClient.initializeClients(obj.clients);
+ } else if (havePendingOperation) {
+ cmClient.serverReconnect();
}
if (setDoc && bodyMismatch) {