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:
vchuser
2026-07-28 17:37:20 +02:00
parent c4ad0416ab
commit b06b3abfd5
+9 -7
View File
@@ -137,30 +137,32 @@ function closeOverlays() {
} }
/** /**
* Oeffnet die Sitzungsliste. Nach einer Aenderung (Umsortieren, Entfernen) * Oeffnet die Sitzungsliste. Raeumt zuerst jede bereits offene Liste weg -
* wird die aktuelle Liste zuerst geschlossen und dann frisch neu aufgebaut, * unabhaengig davon, ob dieser Aufruf von aussen (Stapel-Leiste) oder aus
* damit nach dem Entfernen eines Eintrags nie zwei Listen uebereinanderliegen * einem eigenen Rueckruf (Umsortieren, Entfernen) kommt -, damit nie zwei
* und Stapel-Kopfzeilen sowie Zaehler stets aktuell bleiben. * 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() { function openSessionList() {
closeOverlays();
renderSessionList(app, session, { renderSessionList(app, session, {
onMove: (entryId, stackId) => { onMove: (entryId, stackId) => {
moveEntry(session, entryId, stackId); moveEntry(session, entryId, stackId);
syncView(); syncView();
closeOverlays();
openSessionList(); openSessionList();
}, },
onRemove: (entryId) => { onRemove: (entryId) => {
removeEntry(session, entryId); removeEntry(session, entryId);
syncView(); syncView();
closeOverlays();
openSessionList(); openSessionList();
}, },
onEndSession: () => { onEndSession: () => {
session = createSession(); session = createSession();
clearSession(store); clearSession(store);
view.setLast('Sitzung beendet'); view.setLast('Sitzung beendet');
syncView(); view.setStacks(session.stacks);
}, },
onClose: () => {}, onClose: () => {},
}); });