From 55989058a59a4b29eb2ed4ab45e0506d737d1bb1 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 9 Jun 2026 17:52:15 +0200 Subject: [PATCH] fix(journey-item-row): restore note state and show error when remove patch fails handleNoteRemove mutated UI state optimistically without try/catch. A failed PATCH left the note visually deleted while it survived on the server. Now uses snapshot/rollback identical to handleNoteBlur. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/geschichte/JourneyItemRow.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/geschichte/JourneyItemRow.svelte b/frontend/src/lib/geschichte/JourneyItemRow.svelte index f2b21bee..42d79e51 100644 --- a/frontend/src/lib/geschichte/JourneyItemRow.svelte +++ b/frontend/src/lib/geschichte/JourneyItemRow.svelte @@ -43,10 +43,18 @@ async function handleNoteBlur() { } async function handleNoteRemove() { + const prevDraft = noteDraft; + const prevShowNote = showNote; noteDraft = ''; showNote = false; noteError = ''; - await onNotePatch(null); + try { + await onNotePatch(null); + } catch { + noteDraft = prevDraft; + showNote = prevShowNote; + noteError = m.journey_note_error(); + } } function handleRemoveClick() {