Fix session-list double-open and end-session re-save
openSessionList() now closes any already-open overlay itself before rendering, so a double-tap on the stack bar (which has no lock) can no longer stack two session lists with duplicate handlers. The onMove/ onRemove callbacks no longer need their own closeOverlays() call since openSessionList() does it unconditionally now. onEndSession no longer calls syncView() after clearSession(), which was writing the freshly emptied session straight back into storage and undoing the clear. It now only refreshes the visible stacks, so ending a session actually leaves nothing saved, while a subsequent scan still saves normally via syncView().
This commit is contained in:
+9
-7
@@ -137,30 +137,32 @@ function closeOverlays() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Oeffnet die Sitzungsliste. Nach einer Aenderung (Umsortieren, Entfernen)
|
||||
* wird die aktuelle Liste zuerst geschlossen und dann frisch neu aufgebaut,
|
||||
* damit nach dem Entfernen eines Eintrags nie zwei Listen uebereinanderliegen
|
||||
* und Stapel-Kopfzeilen sowie Zaehler stets aktuell bleiben.
|
||||
* Oeffnet die Sitzungsliste. Raeumt zuerst jede bereits offene Liste weg -
|
||||
* unabhaengig davon, ob dieser Aufruf von aussen (Stapel-Leiste) oder aus
|
||||
* einem eigenen Rueckruf (Umsortieren, Entfernen) kommt -, damit nie zwei
|
||||
* Listen uebereinanderliegen, etwa bei einem Doppeltipp auf die
|
||||
* Stapel-Schaltflaeche. Nach einer Aenderung wird die Liste anschliessend
|
||||
* frisch neu aufgebaut, damit Stapel-Kopfzeilen sowie Zaehler stets aktuell
|
||||
* bleiben.
|
||||
*/
|
||||
function openSessionList() {
|
||||
closeOverlays();
|
||||
renderSessionList(app, session, {
|
||||
onMove: (entryId, stackId) => {
|
||||
moveEntry(session, entryId, stackId);
|
||||
syncView();
|
||||
closeOverlays();
|
||||
openSessionList();
|
||||
},
|
||||
onRemove: (entryId) => {
|
||||
removeEntry(session, entryId);
|
||||
syncView();
|
||||
closeOverlays();
|
||||
openSessionList();
|
||||
},
|
||||
onEndSession: () => {
|
||||
session = createSession();
|
||||
clearSession(store);
|
||||
view.setLast('Sitzung beendet');
|
||||
syncView();
|
||||
view.setStacks(session.stacks);
|
||||
},
|
||||
onClose: () => {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user