From 4c2287fd356f3f7e852ed4b93d53976d1cb2242f Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Wed, 22 Jul 2026 23:03:45 +0100 Subject: [PATCH] fix(trash): don't close the editor when another entry is trashed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- js/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 3e7c970..889df62 100644 --- a/js/app.js +++ b/js/app.js @@ -5290,7 +5290,11 @@ async function deleteEntry(id) { try { await api('/entries/' + id, { method: 'DELETE', headers: authHeaders() }); 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); await loadEntries(); state.trashedCount = (state.trashedCount || 0) + 1;