web: an unrelated session exiting tears down a draft form mid-edit #68

Closed
opened 2026-08-23 21:37:15 +01:00 by naps62-yolo · 1 comment
Collaborator

multiview.render() destroys every draft form and rebuilds it. render() is reached from store.subscribe → closePane → mv.closeSession, so a session exiting anywhere — nothing to do with the pane being typed in — tears down a draft mid-edit.

The typed text survives, because emit() writes to leaf.draft and the rebuilt form re-seeds from it. What does not survive: focus, caret position, and selection. The rebuild also re-issues GET /api/info, GET /api/projects and GET /api/names for a form that was already sitting there.

Reuse the existing form when the leaf still has no sessionId instead of rebuilding it. The draft form already owns its own state and has a destroy(); the render path just needs to stop calling it for a leaf whose draft is unchanged.

Found by the integration review of blitz/spawn-v2. Not folded into #61 because it is a change to the render path rather than to the form, and #61 was in flight in the same file.

Depends on: #61

`multiview.render()` destroys every draft form and rebuilds it. `render()` is reached from `store.subscribe` → `closePane` → `mv.closeSession`, so a session exiting anywhere — nothing to do with the pane being typed in — tears down a draft mid-edit. The typed text survives, because `emit()` writes to `leaf.draft` and the rebuilt form re-seeds from it. What does not survive: focus, caret position, and selection. The rebuild also re-issues `GET /api/info`, `GET /api/projects` and `GET /api/names` for a form that was already sitting there. Reuse the existing form when the leaf still has no `sessionId` instead of rebuilding it. The draft form already owns its own state and has a `destroy()`; the render path just needs to stop calling it for a leaf whose draft is unchanged. Found by the integration review of `blitz/spawn-v2`. Not folded into #61 because it is a change to the render path rather than to the form, and #61 was in flight in the same file. Depends on: #61
naps62-yolo added this to the Spawn v2 milestone 2026-08-23 21:37:15 +01:00
naps62-yolo added the area/webdifficulty/mediumtype/fix labels 2026-08-23 21:37:15 +01:00
Author
Collaborator

Integrated into blitz/spawn-v2.

render() reuses the existing draft form when the leaf still has no session, so a session exiting elsewhere no longer costs the caret or re-issues the three fetches. Regression test in web/src/multiview.test.ts.

Verified on the integration branch: typecheck clean, 94 web tests.

Integrated into `blitz/spawn-v2`. `render()` reuses the existing draft form when the leaf still has no session, so a session exiting elsewhere no longer costs the caret or re-issues the three fetches. Regression test in `web/src/multiview.test.ts`. Verified on the integration branch: typecheck clean, 94 web tests.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Reference: naps62/maestro#68