Spaces:
Paused
Paused
|
Download UI-FIX.md from 2Btainment/repospace: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/2Btainment/repospace/resolve/main/UI-FIX.md
- Command line
-
hf download hf://spaces/2Btainment/repospace/UI-FIX.md
-
curl -L -o UI-FIX.md https://huggingface.co/spaces/2Btainment/repospace/resolve/main/UI-FIX.md
1.42 kB
| # RepoSpace UI fix β blank white screen | |
| **Date:** 2026-10-02 (Europe/Berlin) | |
| **Space:** https://huggingface.co/spaces/2Btainment/repospace | |
| **App:** https://2btainment-repospace.hf.space | |
| ## Symptom | |
| Blank white page when opening session routes (`/space/{id}`), on refresh after Launch, or any deep link under `/space/β¦`. Landing `/` HTML/JS/CSS loaded; session URL returned JSON `{"detail":"Not found"}` (browser shows empty white). | |
| ## Root cause | |
| In `backend/app/main.py`, SPA fallback excluded paths with: | |
| ```python | |
| full_path.startswith(("api/", "api", "s/", "s", "docs", ...)) | |
| ``` | |
| `str.startswith("s")` is true for **`space/...`**, so the React route `/space/:id` never received `index.html`. Hard refresh / direct open β 404 JSON β white UI. | |
| Secondary: `/` and SPA routes only allowed `GET`, so `HEAD /` returned **405** (some probes/proxies use HEAD). | |
| Not the cause: Docker `COPY` of frontend dist, Vite asset paths, or missing CSS (assets returned 200). | |
| ## Fix | |
| 1. Match API/proxy by **first path segment** (`api`, `s`, `docs`, β¦) β never bare `startswith("s")`. | |
| 2. Register `/` and `/{full_path:path}` for **GET + HEAD**. | |
| 3. Regression tests in `backend/tests/test_spa_static.py`. | |
| ## Verify | |
| - `GET /space/abc` β 200 `text/html` with `#root` | |
| - `HEAD /` β 200 | |
| - `GET /assets/*.js|*.css` β 200 | |
| - `GET /api/health` β 200 | |
| - Space runtime `RUNNING` and visible dark UI (not white) | |