From 75fdf4441e2586ab44f7cf5f63aee5b4faf3ffee Mon Sep 17 00:00:00 2001 From: rcourtman Date: Wed, 8 Oct 2025 09:03:50 +0000 Subject: [PATCH] Add null-safety check for groupedContainers in Docker component Fix 'Cannot read properties of undefined (reading some)' error by adding safety check before calling .some() on groupedContainers. The error occurred when groupedContainers() returned undefined in edge cases, causing .some() to fail. Now explicitly checking for truthy value and non-empty array before calling .some(). --- frontend-modern/src/components/Docker/DockerHosts.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend-modern/src/components/Docker/DockerHosts.tsx b/frontend-modern/src/components/Docker/DockerHosts.tsx index 822b10cbd..287b9fc76 100644 --- a/frontend-modern/src/components/Docker/DockerHosts.tsx +++ b/frontend-modern/src/components/Docker/DockerHosts.tsx @@ -507,7 +507,10 @@ export const DockerHosts: Component = (props) => { .filter((group) => group.containers.length > 0); }); - const hasContainers = createMemo(() => groupedContainers().some(g => g.containers.length > 0)); + const hasContainers = createMemo(() => { + const groups = groupedContainers(); + return groups && groups.length > 0 && groups.some(g => g.containers.length > 0); + }); const toggleHostSelection = (hostId: string) => { setSelectedHostId((current) => (current === hostId ? null : hostId));