Add null-safety for dockerHosts in DockerRoute

Prevent 'Cannot read properties of undefined (reading length)' by
ensuring dockerHosts defaults to empty array if undefined.
This commit is contained in:
rcourtman
2025-10-08 09:05:21 +00:00
parent 75fdf4441e
commit 4405bdd344
+2 -1
View File
@@ -71,7 +71,8 @@ function DockerRoute() {
return <div>Loading...</div>;
}
const { state, activeAlerts } = wsContext;
return <DockerHosts hosts={state().dockerHosts} activeAlerts={activeAlerts} />;
const hosts = state().dockerHosts || [];
return <DockerHosts hosts={hosts} activeAlerts={activeAlerts} />;
}
function App() {