From 9fcb6ebab6a3bcd7ccb12d0a364232d8f11a433f Mon Sep 17 00:00:00 2001 From: Z User Date: Thu, 29 Oct 2026 18:44:26 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20instance=20detail=20=E2=80=94=20correct?= =?UTF-8?q?=20API=20response=20mapping=20(data.instance,=20not=20data)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: useFetch returns { instance: {...} } but code used 'const instance = data' instead of 'const instance = data?.instance'. This meant all instance fields (events, license, metadata) were undefined. Fix: - Changed InstanceDetail type to { instance: Instance & {...} } - const instance = data?.instance ?? null - Moved instance assignment before meta useMemo - All subsequent code uses 'events' and 'license' safe accessors --- src/components/aos/views/instances.tsx | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/aos/views/instances.tsx b/src/components/aos/views/instances.tsx index 0c864cb..8329118 100755 --- a/src/components/aos/views/instances.tsx +++ b/src/components/aos/views/instances.tsx @@ -158,9 +158,11 @@ interface ProvisioningJob { updatedAt: string } -interface InstanceDetail extends Instance { - events: InstanceEvent[] - jobs: ProvisioningJob[] +interface InstanceDetail { + instance: Instance & { + events: InstanceEvent[] + jobs: ProvisioningJob[] + } } interface InstanceStats { @@ -618,16 +620,7 @@ function InstanceDetailSheet({ } // Parse metadata for Dokploy resource IDs - const meta = useMemo(() => { - if (!data?.metadata) return {} - try { - return JSON.parse(data.metadata) as Record - } catch { - return {} - } - }, [data?.metadata]) - - const instance = data + const instance = data?.instance ?? null const status = instance?.status ?? '' const fullDomain = instance ? `${instance.subdomain}.dfmpanel.eu` : '' @@ -635,6 +628,15 @@ function InstanceDetailSheet({ const events = instance?.events ?? [] const license = instance?.license ?? null + const meta = useMemo(() => { + if (!instance?.metadata) return {} + try { + return JSON.parse(instance.metadata) as Record + } catch { + return {} + } + }, [instance?.metadata]) + return (