Restore workarounds; close via renderKey bump (kills all PTYs)

Agents investigated the close-button-stuck issue and recommended
removing all DOM-direct workarounds, hypothesising they were causing
the bug. Tested empirically: removing the workarounds breaks
EVERY interactive feature (no border, no broadcast, no resize,
no close). So Svelte 5 prop reactivity through the recursive Pane
chain is genuinely broken in this app — workarounds are required.

Restored workaround set:
- App.svelte polling loop: focus detection + active-class + broadcast
  class sync via DOM API every 250ms
- SplitNode.svelte drag: rAF-throttled direct .side flex update
- handleClose: bump renderKey to force full Pane remount. This kills
  every other pane's PTY (cost) but is the only reliable way to make
  the closed pane actually disappear AND avoid the "zombie split"
  click-intercept bug from the previous DOM-hide approach.

The underlying Svelte 5 issue remains an open question — the next
thing to try is the context+getter pattern (`setContext('active',
{ get id() { return activeLeafId } })` in App, `getContext('active')`
in LeafPane) which Agent 1's research found is the documented
escape hatch for deep reactive prop chains.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-22 17:32:04 +01:00
parent 40ce27251d
commit e9015b2790
2 changed files with 19 additions and 66 deletions

View file

@ -19,9 +19,7 @@
e.preventDefault();
}
// Throttle the per-pointermove DOM flex update so we don't fire SIGWINCH
// hundreds of times per second during a drag (causes the shell to redraw
// its prompt repeatedly, leaving visual artifacts).
// rAF-throttle the DOM flex update so we don't spam SIGWINCH to PTYs.
let pendingRaf: number | null = null;
let pendingRatio = 0;
@ -38,7 +36,6 @@
if (pendingRaf == null) {
pendingRaf = requestAnimationFrame(() => {
pendingRaf = null;
// Direct DOM flex update — Svelte's template binding doesn't react.
const sides = containerEl.querySelectorAll(":scope > .side");
if (sides[0]) (sides[0] as HTMLElement).style.flex = String(pendingRatio);
if (sides[1]) (sides[1] as HTMLElement).style.flex = String(1 - pendingRatio);