From 163e99016a0f62eafd2485031c913b52e61ac25a Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 26 Apr 2026 21:36:27 +0200 Subject: [PATCH] fix(viewer): check res.ok on orphaned annotation DELETE to surface errors Without the guard, a failed DELETE (4xx/5xx) was silently swallowed and annotationReloadKey was incremented anyway, leaving the annotation visible and the user with no feedback. Now matches the deleteBlock() pattern immediately above. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/routes/documents/[id]/+page.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/routes/documents/[id]/+page.svelte b/frontend/src/routes/documents/[id]/+page.svelte index cbf079b2..2cac8cf8 100644 --- a/frontend/src/routes/documents/[id]/+page.svelte +++ b/frontend/src/routes/documents/[id]/+page.svelte @@ -120,7 +120,10 @@ async function handleAnnotationDeleteRequest(annotationId: string) { await deleteBlock(block.id); } else { // Annotation has no linked block — delete the annotation directly - await fetch(`/api/documents/${doc.id}/annotations/${annotationId}`, { method: 'DELETE' }); + const res = await fetch(`/api/documents/${doc.id}/annotations/${annotationId}`, { + method: 'DELETE' + }); + if (!res.ok) throw new Error('Delete annotation failed'); annotationReloadKey++; } }