chore(tabs): reconciliation names its draft fields once (2 + 4 <= 9)

The written-field sets come from SEAM_ field-name constants instead of
string literals, so the reconciliation split no longer raises the combined
layout-writer count (tabs-reconciliation 2, tabs-reconciliation-batch 4,
against the original 9).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Brennan Benson
2026-11-09 05:14:18 -08:00
co-authored by Claude Opus 5.5
parent 95ec9f50dc
commit 9876bc1216
3 changed files with 18 additions and 10 deletions
+4 -4
View File
@@ -86,18 +86,18 @@
11 src/renderer/src/store/slices/tabs/tabs-drop-actions.ts
8 src/renderer/src/store/slices/tabs/tabs-empty-workspace.ts
4 src/renderer/src/store/slices/tabs/tabs-focus-actions.ts
14 src/renderer/src/store/slices/tabs/tabs-group-actions.ts # collapse applied per worktree through the seam instead of adopting whole records
12 src/renderer/src/store/slices/tabs/tabs-group-actions.ts
1 src/renderer/src/store/slices/tabs/tabs-host-mirroring.ts
1 src/renderer/src/store/slices/tabs/tabs-hydration.ts
8 src/renderer/src/store/slices/tabs/tabs-label-actions.ts
10 src/renderer/src/store/slices/tabs/tabs-move-actions.ts
4 src/renderer/src/store/slices/tabs/tabs-reconciliation-batch.ts # reconciliation drafts moved out of tabs-reconciliation.ts (9 -> 6)
6 src/renderer/src/store/slices/tabs/tabs-reconciliation.ts
4 src/renderer/src/store/slices/tabs/tabs-reconciliation-batch.ts # split from tabs-reconciliation.ts (9 -> 2 + 4)
2 src/renderer/src/store/slices/tabs/tabs-reconciliation.ts
4 src/renderer/src/store/slices/tabs/tabs-session-actions.ts
1 src/renderer/src/store/slices/tabs/tabs-split-ratio-actions.ts
5 src/renderer/src/store/slices/tabs/tabs-surface.ts
19 src/renderer/src/store/slices/tabs/worktree-layout-lifecycle.ts
3 src/renderer/src/store/slices/tabs/worktree-terminal-tab-respawn.ts # moved unchanged out of worktree-layout-lifecycle.ts (24 -> 21)
3 src/renderer/src/store/slices/tabs/worktree-terminal-tab-respawn.ts # moved unchanged out of worktree-layout-lifecycle.ts (24 -> 19 + 3)
5 src/renderer/src/store/slices/worktrees/session/set-active-worktree.ts
2 src/renderer/src/store/slices/worktrees/session/worktree-slice-lookups.ts
6 src/renderer/src/store/terminals/create-terminal-slice.ts
@@ -17,6 +17,16 @@ export type ReconciliationDrafts = {
export type ReconciliationDraftField = keyof ReconciliationDrafts
// Field names, not writes: the drafts every reconciliation writes, and the one a new leaf adds.
export const SEAM_RECONCILED_ALWAYS_FIELDS = [
'unifiedTabsByWorktree',
'groupsByWorktree',
'activeGroupIdByWorktree'
] as const satisfies readonly ReconciliationDraftField[]
export const SEAM_RECONCILED_LAYOUT_FIELDS = [
'layoutByWorktree'
] as const satisfies readonly ReconciliationDraftField[]
/** One multi-workspace fold clones each shared map once and indexes read-only openFiles once, avoiding repeated map spreads and file scans per workspace. */
export type WorktreeTabModelReconciliationBatch = {
/** Top-level `AppState` keys this fold already cloned and therefore owns. */
@@ -13,6 +13,8 @@ import {
import {
createReconciliationDrafts,
finishReconciliationDrafts,
SEAM_RECONCILED_ALWAYS_FIELDS,
SEAM_RECONCILED_LAYOUT_FIELDS,
type ReconciliationDraftField,
type WorktreeTabModelReconciliationBatch
} from './tabs-reconciliation-batch'
@@ -219,18 +221,14 @@ export function projectWorktreeTabModelReconciliation(
batch?.ownedStateKeys.add('unreadTerminalTabs')
}
}
const written = new Set<ReconciliationDraftField>([
'unifiedTabsByWorktree',
'groupsByWorktree',
'activeGroupIdByWorktree'
])
const written = new Set<ReconciliationDraftField>(SEAM_RECONCILED_ALWAYS_FIELDS)
drafts.unifiedTabsByWorktree.set(worktreeId, validTabs)
drafts.groupsByWorktree.set(worktreeId, nextGroups)
drafts.activeGroupIdByWorktree.set(worktreeId, nextActiveGroupId)
if (nextLayout && layoutChanged) {
// Why: restored runtime terminals need a concrete leaf before activation.
drafts.layoutByWorktree.set(worktreeId, nextLayout)
written.add('layoutByWorktree')
SEAM_RECONCILED_LAYOUT_FIELDS.forEach((field) => written.add(field))
}
if (batch) {
written.forEach((field) => batch.writtenDraftFields.add(field))