From f15f468b6f6bcbc7a2c36afa2ad6b78251b4855c Mon Sep 17 00:00:00 2001
From: Tom Smith <142233216+tomsmith8@users.noreply.github.com>
Date: Thu, 8 Oct 2026 12:32:31 +0100
Subject: [PATCH] Reserve delete fields and surface edge delete failures
---
src/components/layout/connections-section.tsx | 100 ++++++++++--------
.../__tests__/connections-section.test.tsx | 26 +++++
src/lib/__tests__/node-remap.test.ts | 3 +
src/lib/node-schema-utils.ts | 6 +-
4 files changed, 92 insertions(+), 43 deletions(-)
diff --git a/src/components/layout/connections-section.tsx b/src/components/layout/connections-section.tsx
index f84d42f..c7c2572 100644
--- a/src/components/layout/connections-section.tsx
+++ b/src/components/layout/connections-section.tsx
@@ -24,6 +24,7 @@ type GroupBy = "edge_type" | "node_type"
export function ConnectionsSection({ nodeRefId, schemas, currentNode, onNavigate }: ConnectionsSectionProps) {
const [groupBy, setGroupBy] = useState("edge_type")
const [confirmingDelete, setConfirmingDelete] = useState(null)
+ const [deleteError, setDeleteError] = useState<{ edgeRefId: string; message: string } | null>(null)
const nodes = useGraphStore((s) => s.nodes)
const edges = useGraphStore((s) => s.edges)
const removeEdge = useGraphStore((s) => s.removeEdge)
@@ -72,11 +73,13 @@ export function ConnectionsSection({ nodeRefId, schemas, currentNode, onNavigate
if (!isAdmin) return
try {
await deleteEdge(edgeRefId)
+ removeEdge(edgeRefId)
+ setConfirmingDelete(null)
+ setDeleteError(null)
} catch {
- // Best-effort — remove locally regardless
+ setConfirmingDelete(null)
+ setDeleteError({ edgeRefId, message: "Could not remove connection. Please try again." })
}
- removeEdge(edgeRefId)
- setConfirmingDelete(null)
}
return (
@@ -134,51 +137,64 @@ export function ConnectionsSection({ nodeRefId, schemas, currentNode, onNavigate
{conns.map((conn, i) => {
const isConfirming = confirmingDelete === conn.edge_ref_id
+ const rowError =
+ conn.edge_ref_id !== undefined && deleteError?.edgeRefId === conn.edge_ref_id
+ ? deleteError.message
+ : null
return (
-
-