From 4b9ffaab62c079c03a10daf6770e9caab803b216 Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Wed, 22 Jul 2026 23:09:15 +0100 Subject: [PATCH] fix(trash): warn about unsaved edits when delete asks nothing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With askBeforeDelete off, clicking ✕ on the entry being edited trashed it and closed the editor with no prompt whatsoever — a misclick cost the edits silently. That path now runs the discard gate (no-op unless dirty). When askBeforeDelete is on, its own confirm still stands alone: one modal. Co-Authored-By: Claude Opus 4.8 --- js/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/app.js b/js/app.js index 889df62..ed89123 100644 --- a/js/app.js +++ b/js/app.js @@ -5286,6 +5286,12 @@ async function deleteEntry(id) { danger: true, }); if (!ok) return; + } else if (soState && soState.id === id) { + // No delete confirmation configured: a misclick on ✕ would trash the + // entry AND drop the edits in the open editor with no warning at all. + // The discard gate stands in for it (it no-ops when nothing is dirty). + // Skipped when askBeforeDelete already asked — one modal is enough. + if (!(await requestCloseSlideOver())) return; } try { await api('/entries/' + id, { method: 'DELETE', headers: authHeaders() });