From a3197d0c37b9a18335e6b4108f236fe1e7b111a7 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 28 Jul 2026 05:43:53 +0000 Subject: [PATCH] fix(web): prevent white blank paint before Vite/React boot Pin Vite to :5173 with strictPort, and paint a dark inline shell in index.html so Cursor/agent previews never flash a blank white page. Co-authored-by: huy.phan9 --- AGENTS.md | 8 ++++++-- apps/web/index.html | 6 +++++- apps/web/vite.config.ts | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index ed08baa..5830bb4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,9 +28,13 @@ Standard commands live in `CONTRIBUTING.md` and `package.json` scripts (`npm run - `npm run dev` runs the Express API (`:3001`) and Vite UI (`:5173`) together; open the UI at http://localhost:5173. API liveness: `GET http://localhost:3001/api/health` → `{"ok":true}`. Default mode is single-user (no login). -- Vite is configured with `server.host: true` and `server.allowedHosts: true` so - `http://127.0.0.1:5173` works (not only IPv6 localhost) and Cursor/cloud +- Vite is configured with `server.host: true`, `server.strictPort: true`, and + `server.allowedHosts: true` so `http://127.0.0.1:5173` works (not only IPv6 + localhost), the port does not silently hop to 5174+, and Cursor/cloud port-forward Host headers are not rejected with 403 (which looks like a blank page). +- `apps/web/index.html` paints a dark `#020617` shell inline before JS/CSS so a + hung module graph never shows a white page. If the embedded preview is still + pure white while Playwright/`curl` see the UI, hard-refresh the preview panel. - Vite prints a "Failed to run dependency scan … monaco-editor/esm/…" warning on startup. It is **non-fatal** — Monaco is installed and the SQL editor works; ignore it. diff --git a/apps/web/index.html b/apps/web/index.html index ac23680..77cd1c3 100644 --- a/apps/web/index.html +++ b/apps/web/index.html @@ -1,10 +1,14 @@ - + Fox Schema + + diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index cb49aaa..3c5f09a 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -28,6 +28,8 @@ export default defineConfig({ // makes http://127.0.0.1:5173 fail with ERR_CONNECTION_REFUSED. host: true, port: 5173, + // Don't silently hop to 5174+ — Cursor / agent previews pin :5173. + strictPort: true, // Cursor / cloud port-forwards send a non-localhost Host header; Vite 8 // rejects those with 403 ("Blocked request…") → blank page in the browser. allowedHosts: true,