6ee87174d3
The live-tail stream (now reachable through the new Vite /api proxy) started delivering activity rows with kind="manual_match", a kind the ActivityFeed kindConfig map didn't know about. The map lookup returned undefined, and reading .icon on it threw — taking the whole Activity Log page down. Two fixes: 1. Add "manual_match" to the ActivityKind union in src/types/index.ts and to the kindConfig map in src/components/ActivityFeed.tsx (with a Wrench icon + neutral tone), so the kind is properly typed and rendered. 2. Add a FALLBACK_KIND guard so any future backend-emitted kind that arrives before the frontend is updated no longer crashes the page. kindConfig stays exhaustive for known kinds, so TypeScript still catches missing entries at compile time. Also adds src/components/ActivityFeed.test.tsx with three regression tests (empty state, multi-item render, unknown-kind safety).
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import path from "node:path";
|
|
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
host: true,
|
|
// Proxy /api/* to the FastAPI backend so relative-URL fetchers
|
|
// (e.g. the live-tail NDJSON streams opened by src/lib/tail-stream.ts)
|
|
// resolve through the same origin as the Vite dev server instead of
|
|
// 404'ing. The backend's own port is taken from CYCLONE_PORT (default
|
|
// 8000) — keeping that env-driven so deploys don't have to edit
|
|
// both files.
|
|
proxy: {
|
|
"/api": {
|
|
target: `http://127.0.0.1:${process.env.CYCLONE_PORT ?? "8000"}`,
|
|
changeOrigin: true,
|
|
// SSE/NDJSON streams: disable response buffering so the proxy
|
|
// doesn't hold lines until the chunk size fills. uvicorn already
|
|
// streams as `transfer-encoding: chunked`, but axios-style proxy
|
|
// servers can buffer; the explicit headers keep browsers honest.
|
|
configure: (proxy) => {
|
|
proxy.on("proxyRes", (proxyRes) => {
|
|
proxyRes.headers["x-accel-buffering"] = "no";
|
|
});
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|