Skip to content

fix: keep workspace panes mounted so they don't render blank after switching back#137

Open
mpmisha wants to merge 1 commit into
InbarR:mainfrom
mpmisha:users/mimer/fix/workspace-panes-blank-on-switch
Open

fix: keep workspace panes mounted so they don't render blank after switching back#137
mpmisha wants to merge 1 commit into
InbarR:mainfrom
mpmisha:users/mimer/fix/workspace-panes-blank-on-switch

Conversation

@mpmisha

@mpmisha mpmisha commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What & why

Switching workspaces rendered a single <TilingLayout/> bound to the active workspace's layout.tilingRoot, so the previous workspace's TerminalPanels unmounted and their xterm instances were disposed. PTY output produced while a workspace was hidden was dropped, and the pane came back blank/stale until a manual resize fired SIGWINCH and the running app (e.g. Copilot CLI) redrew.

Issue :
After switching worksapce :
image

After switching workspace and re-sizing (force rendering) the tabs :

image

Fix

Render every workspace's tiling tree as a stacked, absolutely-positioned layer in .layout-area (active visible, inactive visibility:hidden but still sized and rendering) and mount portals for all terminals via the existing TASK-158 host system. Each xterm keeps consuming its PTY while hidden, so switching back is instant and current — no resize, nothing lost.

Changes

  • TilingLayout.tsx — per-workspace stacked layers; portals + host GC over all terminals; active-empty layer shows SessionLoading while restoring (preserves the TASK-117 no-empty-state-flash) / EmptyState otherwise.
  • global.css.tiling-ws-layer (+ .inactive).
  • preload.tsipcRenderer.setMaxListeners(2000); per-terminal IPC listeners (pty:data/pty:exit) now scale with the total terminal count across all workspaces.
  • tests/e2e/workspaces.spec.ts — regression test asserting inactive-workspace panes stay mounted across a switch (fails on the old code).

Testing

  • Verified live in the dev build: gave Copilot a task, switched workspace, waited >10s, switched back → content current immediately, no resize.
  • e2e suite is Windows-only (fixture hardcodes out-e2e/tmax-win32-x64/tmax.exe), so it can't run on macOS locally. New test + changed sources confirmed to parse via esbuild; existing single-workspace specs use >= N panel-count assertions and class selectors, so the extra layer wrapper doesn't affect them.

Notes

  • Follow-up filed (TASK-241): floating panels in inactive workspaces still unmount on switch — this fix is scoped to tiled panes.
assistance: agentic-cli
type: bug
agent-tool: copilot-cli
agent-model: claude-opus-4.8
work-item: n/a

…itching back

Switching workspaces rendered a single <TilingLayout/> bound to the active
workspace's layout.tilingRoot, so the previous workspace's TerminalPanels
unmounted and their xterm instances were disposed. PTY output produced while a
workspace was hidden was dropped, and the pane came back blank/stale until a
manual resize fired SIGWINCH and the running app (e.g. Copilot CLI) redrew.

Render every workspace's tiling tree as a stacked, absolutely-positioned layer
in .layout-area (active visible, inactive visibility:hidden but still sized and
rendering) and mount portals for ALL terminals via the existing TASK-158 host
system. Each xterm keeps consuming its PTY while hidden, so switching back is
instant and current - no resize, nothing lost.

- TilingLayout.tsx: per-workspace stacked layers; portals + host GC over all
  terminals; active-empty layer shows SessionLoading while restoring (preserves
  TASK-117 no-empty-state-flash) / EmptyState otherwise.
- global.css: .tiling-ws-layer (+ .inactive).
- preload.ts: ipcRenderer.setMaxListeners(2000) - per-terminal IPC listeners now
  scale with the total number of terminals across all workspaces.
- tests/e2e/workspaces.spec.ts: regression test asserting inactive-workspace
  panes stay mounted across a switch.

Closes TASK-240. Follow-up TASK-241 filed for floating panels in inactive
workspaces (Option B scoped to tiled panes).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant