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

Loading…
Cancel
Save