fix(web): address fourth-pass bugbot review issues
- DirectTerminal: remove stale muxStatus read from xterm setup effect (muxStatus was captured at mount, leaving reload button permanently disabled); reload button now checks muxStatus directly on each render - TerminalManager: kill PTY and delete map entry when last subscriber unsubscribes, preventing orphaned node-pty processes when all mux clients disconnect Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1de9387465
commit
3eda33ea74
|
|
@ -367,8 +367,12 @@ class TerminalManager {
|
|||
// Return unsubscribe function
|
||||
return () => {
|
||||
terminal.subscribers.delete(callback);
|
||||
// If no subscribers left and PTY is not attached, remove terminal from map
|
||||
if (terminal.subscribers.size === 0 && !terminal.pty) {
|
||||
// Kill PTY and clean up when the last subscriber leaves
|
||||
if (terminal.subscribers.size === 0) {
|
||||
if (terminal.pty) {
|
||||
terminal.pty.kill();
|
||||
terminal.pty = null;
|
||||
}
|
||||
this.terminals.delete(id);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -344,9 +344,6 @@ export function DirectTerminal({
|
|||
}
|
||||
});
|
||||
|
||||
// Update mux status
|
||||
setStatus(muxStatus === "connected" ? "connected" : "connecting");
|
||||
|
||||
// Handle window resize
|
||||
const handleResize = () => {
|
||||
if (fit) {
|
||||
|
|
@ -533,7 +530,7 @@ export function DirectTerminal({
|
|||
{isOpenCodeSession ? (
|
||||
<button
|
||||
onClick={handleReload}
|
||||
disabled={reloading || status !== "connected"}
|
||||
disabled={reloading || muxStatus !== "connected"}
|
||||
title="Restart OpenCode session (/exit then resume mapped session)"
|
||||
aria-label="Restart OpenCode session"
|
||||
className="ml-auto flex items-center gap-1 px-2 py-0.5 text-[11px] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-subtle)] hover:text-[var(--color-text-primary)] disabled:cursor-not-allowed disabled:opacity-70"
|
||||
|
|
|
|||
Loading…
Reference in New Issue