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 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-09 17:52:15 +02:00
parent 1cfa03d1f0
commit 55989058a5

View File

@@ -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() {