web: openDraft never reuses an empty pane, and drops the seed when it does #72

Closed
opened 2026-08-24 00:41:38 +01:00 by naps62-yolo · 0 comments
Collaborator

web/src/multiview.ts — openDraft's "reuse the empty pane" branch is dead after the first render, and drops the seed when it is not.

The branch is taken only when !target.sessionId && !target.draft. But createSpawnForm sets ready = true and calls emit() at the end of loadProjects(), which assigns leaf.draft = values for every empty pane. A second after load, every empty pane has a non-null draft, so n and the Spawn button always split a new pane instead of reusing the untouched draft already on screen.

Inside the pre-load window the branch is taken — and then the seed is discarded: draftForms.get(leaf.id) returns the already-built form, so leaf.draft = draft() is never read. A quick "Spawn similar" onto a fresh empty pane loses the cloned cwd and command.

`web/src/multiview.ts` — **`openDraft`'s "reuse the empty pane" branch is dead after the first render, and drops the seed when it is not.** The branch is taken only when `!target.sessionId && !target.draft`. But `createSpawnForm` sets `ready = true` and calls `emit()` at the end of `loadProjects()`, which assigns `leaf.draft = values` for every empty pane. A second after load, every empty pane has a non-null `draft`, so `n` and the Spawn button always split a new pane instead of reusing the untouched draft already on screen. Inside the pre-load window the branch *is* taken — and then the seed is discarded: `draftForms.get(leaf.id)` returns the already-built form, so `leaf.draft = draft()` is never read. A quick "Spawn similar" onto a fresh empty pane loses the cloned cwd and command.
naps62-yolo added this to the Spawn v2 milestone 2026-08-24 00:41:38 +01:00
naps62-yolo added the area/webdifficulty/mediumtype/fix labels 2026-08-24 00:41:38 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: naps62/maestro#72