fix(maestro): reuse empty draft pane and keep its seed (#72)
openDraft's reuse check was `!target.draft`, dead after first render: createSpawnForm auto-syncs its picked defaults into the leaf's draft once its project load settles, so every empty pane has a non-null draft a second later. `n` and Spawn always split instead of reusing the pane on screen. Reuse now checks only `!target.sessionId`, matching the codebase's own definition of "empty" pane elsewhere. Reusing also drops the leaf's stale form instance so a new seed is read by the rebuilt form instead of being ignored by the old one.
This commit is contained in:
@@ -423,9 +423,15 @@ export function createMultiView(opts: MultiViewOptions): MultiView {
|
||||
return;
|
||||
}
|
||||
const target = findLeaf(tab.root, tab.focusedLeafId)!;
|
||||
if (!target.sessionId && !target.draft) {
|
||||
// An already-empty pane becomes the draft in place.
|
||||
if (!target.sessionId) {
|
||||
// Empty = no session, not `!draft` (#72): the mounted form auto-syncs
|
||||
// picked defaults into `draft` once ready, so that's never reliably null.
|
||||
target.draft = draft();
|
||||
const stale = draftForms.get(target.id);
|
||||
if (stale) {
|
||||
stale.destroy();
|
||||
draftForms.delete(target.id);
|
||||
}
|
||||
} else {
|
||||
// Split a fresh draft beside the focused pane.
|
||||
tab.focusedLeafId = splitLeaf(tab, target.id, null, "row", true);
|
||||
|
||||
Reference in New Issue
Block a user