From eff800dfd7f3cb8cfe50f9d3a0915e3908439a93 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" Date: Thu, 15 Oct 2026 03:21:06 +0100 Subject: [PATCH] fix(frontend): the #124 bumps broke the build -- useRef under React 19 types, manualChunks under vite 8 #124 bumped React to 19.3 and vite to 8.3 together, and with nothing requiring the checks, it merged with the frontend build already red. Two breaks, both real: - React 19's types dropped the zero-argument useRef overload, so TreeView's two timer refs (saveTimer, scrollTimer) no longer compiled: TS2554, twice. They now take the explicit undefined they always had at runtime. - vite 8's rolldown core accepts only the function form of manualChunks; the object form in vite.config.ts died at "manualChunks is not a function". The function keeps the same chunking -- plotly still lands in its own 4.6 MB chunk. tsc and the full bun test suite pass (42/42); vite build completes in under 3s with the same chunk layout as before the bumps. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- frontend/src/views/TreeView.tsx | 6 ++++-- frontend/vite.config.ts | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/TreeView.tsx b/frontend/src/views/TreeView.tsx index c0778282..8147ac29 100644 --- a/frontend/src/views/TreeView.tsx +++ b/frontend/src/views/TreeView.tsx @@ -183,7 +183,9 @@ function TreeCanvas({ source, tree, src, toast }: { // Autosave the view document. const firstSave = useRef(true) - const saveTimer = useRef() + // React 19's types dropped the zero-argument useRef overload, so the timer + // id starts as an explicit undefined instead. + const saveTimer = useRef(undefined) const saveNow = useCallback(() => { const doc: TreeViewDoc = { version: 1, @@ -228,7 +230,7 @@ function TreeCanvas({ source, tree, src, toast }: { el.addEventListener('wheel', onWheel, { passive: false }) return () => el.removeEventListener('wheel', onWheel) }, []) - const scrollTimer = useRef() + const scrollTimer = useRef(undefined) const onScroll = () => { const el = scrollRef.current if (!el) return diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index e25db006..5aea76c5 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -9,9 +9,9 @@ export default defineConfig({ sourcemap: false, rollupOptions: { output: { - manualChunks: { - plotly: ['plotly.js-dist-min'], - }, + // vite 8 (rolldown) took only the function form; the old object form + // died at "manualChunks is not a function". + manualChunks: (id: string) => (id.includes('plotly.js-dist-min') ? 'plotly' : undefined), }, }, },