Fix bug where the alert dialog would not close (#32)

Micromodal maintains a reference to the current open dialog in
this.modal. If one dialog is open while opening another, Micromodal
can get confused and maintain a reference to the wrong one.

One of the problems is that the close action is not instantaneous, so
even closing one dialog and opening another immediately after can
cause the problem.

This change adds a small delay before opening the alert dialog to work
around the problem.
This commit is contained in:
Ian Flanigan 2020-10-11 17:53:33 +02:00 committed by GitHub
parent a200d6de83
commit ccad317f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -233,6 +233,7 @@ export function doSave() {
var name = document.querySelector('#save_name').value;
saveLocalStorage(_currentDrive, name);
MicroModal.close('save-modal');
window.setTimeout(() => openAlert('Saved'), 0);
}
export function doDelete(name) {
@ -508,8 +509,6 @@ function saveLocalStorage(drive, name) {
window.localStorage.diskIndex = JSON.stringify(diskIndex);
openAlert('Saved');
driveLights.label(drive, name);
driveLights.dirty(drive, false);
updateLocalStorage();