Fix OO locks when reloading a page within the same worker

pull/1/head
yflory 4 years ago
parent 3496862ed9
commit 193ea3033e

@ -213,6 +213,19 @@ define([
}
};
// Make sure a former tab on the same worker doesn't have remaining locks
var checkClients = function (clients) {
Object.keys(content.ids).forEach(function (id) {
var tabId = Number(id.slice(33)); // remove the netflux ID and the "-"
if (clients.indexOf(tabId) === -1) {
removeClient({
id: tabId
});
}
});
};
var getFileType = function () {
var type = common.getMetadataMgr().getPrivateData().ooType;
var title = common.getMetadataMgr().getMetadataLazy().title;
@ -728,6 +741,7 @@ define([
sframeChan.on('EV_OO_EVENT', function (obj) {
switch (obj.ev) {
case 'READY':
checkClients(obj.data);
cb();
break;
case 'LEAVE':
@ -1357,6 +1371,7 @@ define([
} catch (e) {}
} else {
setEditable(true);
handleNewLocks({}, content.locks);
if (APP.unsavedChanges) {
var unsaved = APP.unsavedChanges;
delete APP.unsavedChanges;

@ -40,7 +40,7 @@ define([
if (!c.id) { c.id = chan.wc.myID + '-' + client; }
getHistory(ctx, client, function () {
ctx.emit('READY', '', [client]);
ctx.emit('READY', chan.clients, [client]);
});
// ==> And push the new tab to the list
@ -149,7 +149,7 @@ define([
}
// End of history: emit READY
if (parsed.state && parsed.state === 1 && parsed.channel) {
ctx.emit('READY', '', chan.clients);
ctx.emit('READY', chan.clients, chan.clients);
return;
}
if (parsed.error && parsed.channel) { return; }

Loading…
Cancel
Save