Skip to content

Commit 33a84fa

Browse files
fix: sync running state on LiveView remount from latest run API
- On remount, check getLatestRun().running to sync stop button visibility - Prevents stop button disappearing after page navigation
1 parent 6e74f18 commit 33a84fa

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎cmd/slmcode/ui/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
99
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
1010
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='6' fill='%237c3aed'/><text x='16' y='22' font-family='system-ui' font-weight='700' font-size='18' fill='white' text-anchor='middle'>SL</text></svg>" />
11-
<script type="module" crossorigin src="/assets/index-DWO3q2io.js"></script>
11+
<script type="module" crossorigin src="/assets/index-kJfYT4q1.js"></script>
1212
<link rel="stylesheet" crossorigin href="/assets/index-A47pACXv.css">
1313
</head>
1414
<body class="antialiased">

‎web/src/components/Live/LiveView.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ export default function LiveView() {
143143

144144
useEffect(() => {
145145
connectSSE();
146-
getLatestRun().then(setResult).catch(() => {});
146+
// Sync running state from latest run on remount
147+
getLatestRun().then((r) => {
148+
setResult(r);
149+
if (!r.running && r.result) setRunning(false);
150+
}).catch(() => {});
147151
return () => {
148152
eventSource.current?.close();
149153
};

0 commit comments

Comments
 (0)