summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Sauer <[email protected]>2026-01-14 01:03:34 +0100
committerGitHub <[email protected]>2026-01-13 18:03:34 -0600
commit1ff46c75fa72a552f832eec58156f7a7a8e1f128 (patch)
treee7cc7d54dc53a7a4060225659260951ccaa6de57
parent73d5cacc06594398cfa543089012d5ed3b0e9726 (diff)
downloadopencode-1ff46c75fa72a552f832eec58156f7a7a8e1f128.tar.gz
opencode-1ff46c75fa72a552f832eec58156f7a7a8e1f128.zip
fix(tui): track all timeouts in Footer to prevent memory leak (#8255)
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx
index d10c49c83..8ace2fff3 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx
@@ -25,24 +25,27 @@ export function Footer() {
})
onMount(() => {
+ // Track all timeouts to ensure proper cleanup
+ const timeouts: ReturnType<typeof setTimeout>[] = []
+
function tick() {
if (connected()) return
if (!store.welcome) {
setStore("welcome", true)
- timeout = setTimeout(() => tick(), 5000)
+ timeouts.push(setTimeout(() => tick(), 5000))
return
}
if (store.welcome) {
setStore("welcome", false)
- timeout = setTimeout(() => tick(), 10_000)
+ timeouts.push(setTimeout(() => tick(), 10_000))
return
}
}
- let timeout = setTimeout(() => tick(), 10_000)
+ timeouts.push(setTimeout(() => tick(), 10_000))
onCleanup(() => {
- clearTimeout(timeout)
+ timeouts.forEach(clearTimeout)
})
})