Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: Image Gen status badge no longer stuck on SD API unreachable in Local mode
Adam Eivy4af7b754ed1e
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 543bedb125..8de0f13eb0 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -1,5 +1,9 @@# Next Release+## Fixed++- **Image Gen status badge stuck on "SD API unreachable" when Local mode is selected.** The page mounts before settings load, so the first `refreshStatus` call goes out with `mode=external` (the fallback in `effectiveMode = selectedMode || status?.mode || 'external'`). The local-mode probe that fires moments later (after settings populate `selectedMode='local'`) returns instantly because it just checks if the Python path is set — but the original external-mode probe is still in flight, blocking on a TCP timeout against the unconfigured SD API URL. When that slow response finally arrived, it overwrote the green "mflux/local" badge with the red "SD API unreachable — Settings" message, even though the Local chip was clearly selected. Token-guarded `refreshStatus` so each call records a monotonically incrementing token and only applies its `setStatus` if its token still matches the latest one — stale responses get silently dropped. File: `client/src/pages/ImageGen.jsx`.+## Changed- **Pin all `package.json` dependencies and overrides to exact versions.** Removed `^` ranges from every dep/override across root, `server/`, and `client/` `package.json` files (e.g. `kokoro-js: ^1.2.1` → `1.2.1`; overrides like `path-to-regexp`, `lodash`, `basic-ftp`, `follow-redirects`, `brace-expansion`, `socket.io-parser`, and the nested `minimatch@3 → brace-expansion`). Lockfiles refreshed with no resolved-version drift — a defensive pin so future installs can't pick up a freshly-published patch in the override graph without an explicit bump.diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsxindex dfa867e0f7..6a1e94856c 100644--- a/client/src/pages/ImageGen.jsx+++ b/client/src/pages/ImageGen.jsx@@ -105,12 +105,27 @@ export default function ImageGen() {// Status reflects the currently-selected backend, not the saved default —// chip changes re-probe via the optional ?mode= override so the badge and// notConnected gating stay aligned with what Generate would actually use.+ //+ // Token-guarded so a slow stale check (e.g. the initial `external` probe+ // timing out against an unconfigured SD API URL) can't overwrite the+ // newer `local` probe that already returned green. Without this the badge+ // gets stuck on "SD API unreachable" even though Local is selected.+ const statusRequestToken = useRef(0);const refreshStatus = useCallback((mode) => {+ const myToken = ++statusRequestToken.current;setStatusLoading(true);getImageGenStatus(mode)- .then(setStatus)- .catch(() => setStatus({ connected: false, reason: 'Status check failed' }))- .finally(() => setStatusLoading(false));+ .then((s) => {+ if (myToken !== statusRequestToken.current) return;+ setStatus(s);+ })+ .catch(() => {+ if (myToken !== statusRequestToken.current) return;+ setStatus({ connected: false, reason: 'Status check failed' });+ })+ .finally(() => {+ if (myToken === statusRequestToken.current) setStatusLoading(false);+ });}, []);const refreshGallery = useCallback(() => {