summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Sauer <[email protected]>2026-01-14 01:03:34 +0100
committerFrank <[email protected]>2026-01-13 19:51:02 -0500
commit8917dfdf5e30d4b920495ed844efe02cda635dcf (patch)
tree06dcfcb9500ca25c4cfb3d3934ac491b317b0dd2
parent86900d71f5aa1c9c320bcb93a3380bbea489541d (diff)
downloadopencode-8917dfdf5e30d4b920495ed844efe02cda635dcf.tar.gz
opencode-8917dfdf5e30d4b920495ed844efe02cda635dcf.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)
})
})