mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 19:26:31 -05:00
Fix server reconnect might not resend pending operations
This commit is contained in:
parent
e427709042
commit
734d475c0e
1 changed files with 4 additions and 1 deletions
|
@ -2648,7 +2648,8 @@ socket.on('doc', function (obj) {
|
||||||
obj = JSON.parse(obj);
|
obj = JSON.parse(obj);
|
||||||
var body = obj.str;
|
var body = obj.str;
|
||||||
var bodyMismatch = editor.getValue() !== body;
|
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();
|
saveInfo();
|
||||||
if (setDoc && bodyMismatch) {
|
if (setDoc && bodyMismatch) {
|
||||||
|
@ -2682,6 +2683,8 @@ socket.on('doc', function (obj) {
|
||||||
cmClient.setState(new ot.Client.Synchronized());
|
cmClient.setState(new ot.Client.Synchronized());
|
||||||
cmClient.initializeClientList();
|
cmClient.initializeClientList();
|
||||||
cmClient.initializeClients(obj.clients);
|
cmClient.initializeClients(obj.clients);
|
||||||
|
} else if (havePendingOperation) {
|
||||||
|
cmClient.serverReconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setDoc && bodyMismatch) {
|
if (setDoc && bodyMismatch) {
|
||||||
|
|
Loading…
Reference in a new issue