From f1841006c314c7f937459761757a88f49fd92773 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 9 Feb 2026 22:42:11 +0000 Subject: [PATCH] Add runtime health polling and sidebar offline indicator Co-authored-by: Theo Browne --- apps/renderer/src/App.tsx | 40 ++++++++++++++++++++++++ apps/renderer/src/components/Sidebar.tsx | 5 +++ 2 files changed, 45 insertions(+) diff --git a/apps/renderer/src/App.tsx b/apps/renderer/src/App.tsx index 83b734ff71..eb14eb15f9 100644 --- a/apps/renderer/src/App.tsx +++ b/apps/renderer/src/App.tsx @@ -60,6 +60,45 @@ function BootstrapRouter() { return null; } +function RuntimeHealthRouter() { + const api = readNativeApi(); + const { dispatch } = useStore(); + + useEffect(() => { + if (!api) return; + let cancelled = false; + + const checkHealth = async () => { + try { + await api.app.health(); + if (cancelled) return; + dispatch({ type: "SET_RUNTIME_ERROR", error: null }); + } catch (error) { + if (cancelled) return; + dispatch({ + type: "SET_RUNTIME_ERROR", + error: + error instanceof Error + ? error.message + : "Could not connect to the local t3 runtime.", + }); + } + }; + + void checkHealth(); + const interval = window.setInterval(() => { + void checkHealth(); + }, 8_000); + + return () => { + cancelled = true; + window.clearInterval(interval); + }; + }, [api, dispatch]); + + return null; +} + function Layout() { const api = readNativeApi(); const { state } = useStore(); @@ -78,6 +117,7 @@ function Layout() { return (
+ {state.runtimeError && state.projects.length === 0 && (
diff --git a/apps/renderer/src/components/Sidebar.tsx b/apps/renderer/src/components/Sidebar.tsx index 74e2603abd..e618c75f61 100644 --- a/apps/renderer/src/components/Sidebar.tsx +++ b/apps/renderer/src/components/Sidebar.tsx @@ -131,6 +131,11 @@ export default function Sidebar() { CodeThing + {state.runtimeError && ( + + Offline + + )}