diff options
| author | Daniel Sauer <[email protected]> | 2026-01-14 01:03:34 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-13 18:03:34 -0600 |
| commit | 1ff46c75fa72a552f832eec58156f7a7a8e1f128 (patch) | |
| tree | e7cc7d54dc53a7a4060225659260951ccaa6de57 | |
| parent | 73d5cacc06594398cfa543089012d5ed3b0e9726 (diff) | |
| download | opencode-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.tsx | 11 |
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) }) }) |
