mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 11:13:26 +00:00
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().
This commit is contained in:
@@ -507,7 +507,10 @@ export const DockerHosts: Component<DockerHostsProps> = (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));
|
||||
|
||||
Reference in New Issue
Block a user