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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user