From 6c9efd6a2ad8955c36581943a691d48c8afeeffa Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 12 Aug 2026 23:32:47 -0700 Subject: [PATCH] type(store): build lineage overlays on mutable records mergeExactHostLineage was writing into AppState map types after they became Readonly. Use local mutable Records, then reuseEqualRecordMap. Co-authored-by: Orca --- src/renderer/src/hooks/direct-ssh-host-hydration.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/hooks/direct-ssh-host-hydration.ts b/src/renderer/src/hooks/direct-ssh-host-hydration.ts index 0ce26ac7476..5acea7cf71e 100644 --- a/src/renderer/src/hooks/direct-ssh-host-hydration.ts +++ b/src/renderer/src/hooks/direct-ssh-host-hydration.ts @@ -3,6 +3,7 @@ import { getRepoExecutionHostId, toSshExecutionHostId } from '../../../shared/ex import type { HostLineageSnapshot } from '../../../shared/host-lineage-contract' import type { HostRepoCatalogSnapshot } from '../../../shared/host-repo-catalog-contract' import type { DirectSshAuthority } from '../../../shared/ssh-types' +import type { WorktreeLineage, WorkspaceLineage } from '../../../shared/types' import { isWorkspaceKey } from '../../../shared/workspace-scope' import type { AppState } from '../store/types' import { reuseEqualRecordMap } from '../store/slices/repo-identity-reconcile' @@ -79,7 +80,7 @@ function mergeExactHostLineage( catalogRevision: number ): AppState { const scope = directSshHostHydrationScope(state, authority, catalogRevision) - const nextWorktreeLineageById: AppState['worktreeLineageById'] = {} + const nextWorktreeLineageById: Record = {} for (const [worktreeId, existing] of Object.entries(state.worktreeLineageById)) { if (!scope.gitWorktreeIds.has(worktreeId)) { nextWorktreeLineageById[worktreeId] = existing @@ -90,7 +91,7 @@ function mergeExactHostLineage( nextWorktreeLineageById[worktreeId] = incoming } } - const nextWorkspaceLineageByChildKey: AppState['workspaceLineageByChildKey'] = {} + const nextWorkspaceLineageByChildKey: Record = {} for (const [childKey, existing] of Object.entries(state.workspaceLineageByChildKey)) { if (!isWorkspaceKey(childKey) || !scope.lineageWorkspaceKeys.has(childKey)) { nextWorkspaceLineageByChildKey[childKey] = existing