Make sure the infinite spinner modal is not displayed multiple times

pull/1/head
yflory 7 years ago
parent 3ebb5ca493
commit fd7bb3aadb

@ -422,6 +422,7 @@ define([
textPatcher = TextPatcher.create({ realtime: cpNfInner.chainpad }); textPatcher = TextPatcher.create({ realtime: cpNfInner.chainpad });
var infiniteSpinnerModal = false;
window.setInterval(function () { window.setInterval(function () {
if (state === STATE.DISCONNECTED) { return; } if (state === STATE.DISCONNECTED) { return; }
var l; var l;
@ -432,13 +433,15 @@ define([
} }
if (l.lag < badStateTimeout) { return; } if (l.lag < badStateTimeout) { return; }
if (state === STATE.INFINITE_SPINNER) { return; } if (infiniteSpinnerModal) { return; }
infiniteSpinnerModal = true;
stateChange(STATE.INFINITE_SPINNER); stateChange(STATE.INFINITE_SPINNER);
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) { Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
if (!yes) { return; } if (!yes) { return; }
common.gotoURL(); common.gotoURL();
}); });
cpNfInner.chainpad.onSettle(function () { cpNfInner.chainpad.onSettle(function () {
infiniteSpinnerModal = false;
Cryptpad.findCancelButton().click(); Cryptpad.findCancelButton().click();
stateChange(STATE.READY); stateChange(STATE.READY);
onRemote(); onRemote();

Loading…
Cancel
Save