From 4272407881eb495a838659b5fc49f62fc18754e0 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sat, 13 Dec 2025 17:27:44 -0500 Subject: [PATCH] playground: adjust react compiler to fail build on error --- playground/src/App.tsx | 17 ++++++++++++----- playground/vite.config.ts | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/playground/src/App.tsx b/playground/src/App.tsx index dece20cd..a53752f8 100644 --- a/playground/src/App.tsx +++ b/playground/src/App.tsx @@ -80,15 +80,22 @@ function initialMode(): Mode | null { return "Lint" } +// pulling this into its own function due to gap in react compiler +// https://github.com/facebook/react/issues/34761 +// this avoid a de-opt +function saveMode(mode: Mode | null) { + try { + localStorage.setItem("play-mode-v1", mode ?? "none") + } catch { + // pass + } +} + function useMode() { const [mode, setActiveMode] = useState(() => initialMode()) useEffect(() => { - try { - localStorage.setItem("play-mode-v1", mode ?? "none") - } catch { - // pass - } + saveMode(mode) }, [mode]) return [mode, setActiveMode] as const diff --git a/playground/vite.config.ts b/playground/vite.config.ts index 32c28081..7a13cdcc 100644 --- a/playground/vite.config.ts +++ b/playground/vite.config.ts @@ -3,7 +3,7 @@ import { sentryVitePlugin } from "@sentry/vite-plugin" import react from "@vitejs/plugin-react" import tailwindcss from "@tailwindcss/vite" -const ReactCompilerConfig = {} +const ReactCompilerConfig = { panicThreshold: "all_errors" } // https://vite.dev/config/ export default defineConfig({