fix: guard fleet containers iteration, prevent TypeError on null

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian 2026-03-31 03:05:52 +01:00
parent 6c5e50b4d5
commit f162ff85db
2 changed files with 4 additions and 4 deletions

View File

@ -67,12 +67,12 @@
<!-- Container List -->
<div class="mb-4">
<h4 class="text-xs font-medium text-white/60 mb-2 uppercase tracking-wide">Containers</h4>
<div v-if="!node.containers.length" class="text-white/40 text-sm py-2">
<div v-if="!node.containers?.length" class="text-white/40 text-sm py-2">
No containers reported.
</div>
<div v-else class="space-y-1">
<div
v-for="c in node.containers"
v-for="c in (node.containers || [])"
:key="c.id"
class="flex items-center gap-3 p-2 bg-white/5 rounded-lg"
>

View File

@ -107,7 +107,7 @@ export function formatTimestamp(ts: string): string {
}
export function getContainerState(node: FleetNode, appId: string): string | null {
const container = node.containers.find(c => c.id === appId)
const container = (node.containers || []).find(c => c.id === appId)
if (!container) return null
return container.state
}
@ -190,7 +190,7 @@ export function useFleetData() {
const allAppIds = computed(() => {
const appSet = new Set<string>()
for (const node of nodes.value) {
for (const c of node.containers) {
for (const c of (node.containers || [])) {
appSet.add(c.id)
}
}