spaceforge / UI-FIX.md
2Btainment's picture
docs: UI-FIX.md verify notes + commit sha
69a2bac verified
|
Raw History Blame Contribute Delete
1.95 kB

SpaceForge UI fix — blank page after Analyze

Date: 2026-10-01 (Europe/Berlin)
Space: https://huggingface.co/spaces/2Btainment/spaceforge
App: https://2btainment-spaceforge.hf.space
Fix commit: 48a7b171cebe7200c52a8d891dade4f0762b408b
Verified RUNNING: 2026-10-01 ~13:18 CEST — analyze returns string hardware; UI shows hello_world meta + targets; build html_widget+pwa OK

Symptom

After pasting a Space URL and clicking Analyze, the UI disappeared — only the dark CSS background remained (empty #root). No analysis card, no targets, no useful error.

Root cause

Hugging Face’s Spaces API returns runtime.hardware as an object:

{"current": "cpu-basic", "requested": "cpu-basic"}

fetch_space_info passed that object through unchanged. The React UI rendered {space.hardware} directly. React throws:

Objects are not valid as a React child

The error boundary / StrictMode unmount left only body styles → “background only”.

API itself was healthy (POST /api/analyze 200); this was a client render crash, not CORS, routing, or a dead Analyze handler.

Fix

  1. backend/app/providers/huggingface.py — normalize hardware to a plain string (current → requested → fallback).
  2. frontend/src/App.tsx — defensive formatHardware() so object payloads cannot crash the tree.
  3. frontend/src/types/index.ts — type allows string or {current,requested}.
  4. backend/app/main.py — SPA catch-all no longer serves index.html for /api/* / docs (avoids HTML-for-JSON traps).

Verify

  • POST /api/analyze → "hardware": "cpu-basic" (string)
  • Analyze + Build (html_widget / pwa) end-to-end on live Space
  • UI shows meta card + target picker after Analyze

Not the cause

Static SPA asset 404s, wrong API base URL, CORS, CSS covering buttons, Docker path issues — assets and /api/health were already 200 under auth.