1 Commits
Author SHA1 Message Date
clawdbuddy bf209e5236 fix: load node specs from backend on App mount so remote-host config is included in sim start
Previously nodeSpecs was only set when user visited NodeManager tab.
If user clicked Start from Dashboard without visiting NodeManager first,
the start request had no 'nodes' field -> backend generated all-local
defaults -> remote host-manet-node never started.

Fix: fetch /api/nodes/specs in App useEffect on mount.
2026-05-17 14:42:11 +08:00
+9 -1
View File
@@ -1,4 +1,4 @@
import { useState, useCallback } from 'react';
import { useState, useCallback, useEffect } from 'react';
import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import { useSimConfig } from '@/hooks/useSimConfig';
@@ -42,6 +42,14 @@ function App() {
const [activePage, setActivePage] = useState<PageKey>('dashboard');
const [nodeSpecs, setNodeSpecs] = useState<NodeSpec[] | undefined>(undefined);
// Load node specs from backend on mount (so Start always includes remote-host config)
useEffect(() => {
fetch('/api/nodes/specs')
.then(r => r.ok ? r.json() : [])
.then(data => { if (Array.isArray(data) && data.length > 0) setNodeSpecs(data); })
.catch(() => {});
}, []);
const handleStart = () => {
startSimulation(config, undefined, nodeSpecs);
};