From 6759327ee3851d4d7c464de2ca2060e54a00a99d Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Fri, 13 Mar 2026 11:01:38 -0400 Subject: [PATCH] fix: null reference crash in saveHostInline after edit Save editingHost.id to local var before nulling the ref. Prevents TypeError on Array.find during post-save refresh. Co-Authored-By: Claude Opus 4.6 --- frontend/pages/index.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 4f2397b..70c2d6f 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -167,8 +167,9 @@ async function saveHostInline() { credentialId: inlineHost.value.credentialId, tags, } - if (editingHost.value?.id) { - await connections.updateHost(editingHost.value.id, payload) + const wasEditingId = editingHost.value?.id + if (wasEditingId) { + await connections.updateHost(wasEditingId, payload) } else { await connections.createHost(payload) } @@ -177,8 +178,8 @@ async function saveHostInline() { inlineHost.value = { name: '', hostname: '', port: 22, protocol: 'ssh', groupId: null, tags: '', credentialId: null } await connections.fetchTree() // Refresh selected host details if it was the one we edited - if (selectedHost.value?.id === editingHost.value?.id) { - const updated = connections.hosts.find((h: any) => h.id === selectedHost.value.id) + if (wasEditingId && selectedHost.value?.id === wasEditingId) { + const updated = connections.hosts.find((h: any) => h.id === wasEditingId) if (updated) selectedHost.value = updated } }