fix(trash): don't close the editor when another entry is trashed

Clicking the ✕ on any row called closeSlideOver() unconditionally, so an
open editor with unsaved edits on a DIFFERENT entry vanished without the
discard prompt. Close it only when it holds the entry being trashed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-22 23:03:45 +01:00
parent 3f07c1217b
commit 4c2287fd35
+5 -1
View File
@@ -5290,7 +5290,11 @@ async function deleteEntry(id) {
try { try {
await api('/entries/' + id, { method: 'DELETE', headers: authHeaders() }); await api('/entries/' + id, { method: 'DELETE', headers: authHeaders() });
toast('Moved to trash'); toast('Moved to trash');
closeSlideOver(); // Close the editor ONLY when it holds the entry being trashed. Deleting
// some other row used to close it unconditionally, silently dropping
// unsaved edits (no discard prompt — this path bypasses
// requestCloseSlideOver by design: the entry is gone either way).
if (soState && soState.id === id) closeSlideOver();
state.checked.delete(id); state.checked.delete(id);
await loadEntries(); await loadEntries();
state.trashedCount = (state.trashedCount || 0) + 1; state.trashedCount = (state.trashedCount || 0) + 1;