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 <noreply@anthropic.com>
This commit is contained in:
parent
340a862826
commit
6759327ee3
@ -167,8 +167,9 @@ async function saveHostInline() {
|
|||||||
credentialId: inlineHost.value.credentialId,
|
credentialId: inlineHost.value.credentialId,
|
||||||
tags,
|
tags,
|
||||||
}
|
}
|
||||||
if (editingHost.value?.id) {
|
const wasEditingId = editingHost.value?.id
|
||||||
await connections.updateHost(editingHost.value.id, payload)
|
if (wasEditingId) {
|
||||||
|
await connections.updateHost(wasEditingId, payload)
|
||||||
} else {
|
} else {
|
||||||
await connections.createHost(payload)
|
await connections.createHost(payload)
|
||||||
}
|
}
|
||||||
@ -177,8 +178,8 @@ async function saveHostInline() {
|
|||||||
inlineHost.value = { name: '', hostname: '', port: 22, protocol: 'ssh', groupId: null, tags: '', credentialId: null }
|
inlineHost.value = { name: '', hostname: '', port: 22, protocol: 'ssh', groupId: null, tags: '', credentialId: null }
|
||||||
await connections.fetchTree()
|
await connections.fetchTree()
|
||||||
// Refresh selected host details if it was the one we edited
|
// Refresh selected host details if it was the one we edited
|
||||||
if (selectedHost.value?.id === editingHost.value?.id) {
|
if (wasEditingId && selectedHost.value?.id === wasEditingId) {
|
||||||
const updated = connections.hosts.find((h: any) => h.id === selectedHost.value.id)
|
const updated = connections.hosts.find((h: any) => h.id === wasEditingId)
|
||||||
if (updated) selectedHost.value = updated
|
if (updated) selectedHost.value = updated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user