fix(daemon,app): graceful-shutdown final snapshot pass + StoppedSnapshot detach cleanup

Addresses final-review findings: Cmd::Shutdown now snapshots all live surfaces
synchronously before exit (spec graceful-shutdown requirement); StoppedSnapshot
calls detachSurface on unmount to release the bridge output channel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 16:24:53 +07:00
parent 5c76493a34
commit ce6a8d56be
2 changed files with 32 additions and 19 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import { SearchBar } from "./SearchBar";
import { StatusRing } from "./StatusRing";
import { COLORS, FONT, STATE_COLOR } from "./theme";
import type { LayoutNode, SurfaceState, SurfaceView } from "./layoutTypes";
import { setRatios, restartSurface, setZoom, moveSurface, attachSurface } from "./socketBridge";
import { setRatios, restartSurface, setZoom, moveSurface, attachSurface, detachSurface } from "./socketBridge";
interface Props {
workspaceId: string;
@@ -149,7 +149,7 @@ function StoppedSnapshot({ surfaceId, font, palette }: { surfaceId: string; font
void attachSurface(surfaceId, () => {}).then((res) => {
if (!disposed && res.snapshot) term.write(res.snapshot);
});
return () => { disposed = true; term.dispose(); };
return () => { disposed = true; term.dispose(); void detachSurface(surfaceId); };
}, [surfaceId, font, palette]); // eslint-disable-line react-hooks/exhaustive-deps
return <div ref={hostRef} style={{ position: "absolute", inset: 0, opacity: 0.45, pointerEvents: "none" }} />;
}