From 915dc946b5f2b1cf52b9ad0796e2566d6effede3 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Wed, 18 Mar 2026 14:28:54 +1100 Subject: [PATCH 1/3] fix(ui): persist dismissed repo explanation in memory when switching projects When a user dismissed a repo explanation banner, only the database was updated and a local component flag was set. Switching projects destroyed the component (resetting the flag) while the in-memory repoLabelsByProject map retained the stale reason, causing it to reappear. Now the dismiss callback propagates up to ProjectHome to null out the reason in the in-memory map as well. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/lib/features/branches/BranchCard.svelte | 3 +++ .../src/lib/features/projects/ProjectHome.svelte | 11 +++++++++++ .../src/lib/features/projects/ProjectSection.svelte | 3 +++ 3 files changed, 17 insertions(+) diff --git a/apps/staged/src/lib/features/branches/BranchCard.svelte b/apps/staged/src/lib/features/branches/BranchCard.svelte index 3aab3563..f67beb0e 100644 --- a/apps/staged/src/lib/features/branches/BranchCard.svelte +++ b/apps/staged/src/lib/features/branches/BranchCard.svelte @@ -52,6 +52,7 @@ onRename?: (branchName: string) => void; onRetryWorktree?: () => void; onWorkspaceStatusChange?: (status: WorkspaceStatus, workstationId?: number | null) => void; + onDismissReason?: (projectRepoId: string) => void; } let { @@ -65,6 +66,7 @@ onRename, onRetryWorktree, onWorkspaceStatusChange, + onDismissReason, }: Props = $props(); // Determine if this is a local or remote branch @@ -521,6 +523,7 @@ if (branch.projectRepoId) { try { await commands.clearProjectRepoReason(branch.projectRepoId); + onDismissReason?.(branch.projectRepoId); } catch (e) { console.error('Failed to clear repo reason:', e); } diff --git a/apps/staged/src/lib/features/projects/ProjectHome.svelte b/apps/staged/src/lib/features/projects/ProjectHome.svelte index 2ab87476..e11d9c5a 100644 --- a/apps/staged/src/lib/features/projects/ProjectHome.svelte +++ b/apps/staged/src/lib/features/projects/ProjectHome.svelte @@ -753,6 +753,17 @@ )} onRepoSelected={(selection) => handleRepoSelected(project.id, selection)} onRetryWorktree={(branchId) => setupBranchWorktree(branchId, project.id)} + onDismissReason={(projectRepoId) => { + const projectLabels = repoLabelsByProject.get(project.id); + if (projectLabels) { + const entry = projectLabels.get(projectRepoId); + if (entry) { + const next = new Map(projectLabels); + next.set(projectRepoId, { ...entry, reason: null }); + repoLabelsByProject = new Map(repoLabelsByProject).set(project.id, next); + } + } + }} /> {/each} diff --git a/apps/staged/src/lib/features/projects/ProjectSection.svelte b/apps/staged/src/lib/features/projects/ProjectSection.svelte index f3c25c90..c9d1adda 100644 --- a/apps/staged/src/lib/features/projects/ProjectSection.svelte +++ b/apps/staged/src/lib/features/projects/ProjectSection.svelte @@ -68,6 +68,7 @@ ) => void; onRepoSelected?: (selection: RepoPickerSelection) => void; onRetryWorktree?: (branchId: string) => void; + onDismissReason?: (projectRepoId: string) => void; } let { @@ -89,6 +90,7 @@ onWorkspaceStatusChange, onRepoSelected, onRetryWorktree, + onDismissReason, }: Props = $props(); let sortedBranches = $derived([...branches].sort((a, b) => b.createdAt - a.createdAt)); @@ -644,6 +646,7 @@ onRetryWorktree={() => onRetryWorktree?.(branch.id)} onWorkspaceStatusChange={(status, workstationId) => onWorkspaceStatusChange?.(branch.id, status, workstationId)} + onDismissReason={(projectRepoId) => onDismissReason?.(projectRepoId)} /> {/each} From f90c6f2857f967596621cc71059ba46bc5692183 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Wed, 18 Mar 2026 14:49:07 +1100 Subject: [PATCH 2/3] refactor(ui): flatten repo cache into a single Map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the nested repoLabelsByProject map (projectId → repoId → tuple) with a flat reposById map (repoId → ProjectRepo). This stores the full ProjectRepo object instead of a hand-extracted {githubRepo, subpath, reason} subset, making updates (including dismiss) simpler and eliminating the redundant per-project grouping. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../lib/features/branches/BranchCard.svelte | 3 +- .../branches/BranchCardActionsBar.svelte | 4 +- .../branches/BranchCardHeaderInfo.svelte | 3 +- .../lib/features/projects/ProjectHome.svelte | 151 ++++++------------ .../features/projects/ProjectSection.svelte | 22 +-- 5 files changed, 60 insertions(+), 123 deletions(-) diff --git a/apps/staged/src/lib/features/branches/BranchCard.svelte b/apps/staged/src/lib/features/branches/BranchCard.svelte index f67beb0e..e16fdffe 100644 --- a/apps/staged/src/lib/features/branches/BranchCard.svelte +++ b/apps/staged/src/lib/features/branches/BranchCard.svelte @@ -19,6 +19,7 @@ import type { Branch, BranchTimeline as BranchTimelineData, + ProjectRepo, SessionStatusPayload, WorkspaceStatus, } from '../../types'; @@ -43,7 +44,7 @@ interface Props { branch: Branch; - repoLabel?: { githubRepo: string; subpath: string | null; reason?: string | null } | null; + repoLabel?: ProjectRepo | null; projectName?: string; deleting?: boolean; worktreeError?: string; diff --git a/apps/staged/src/lib/features/branches/BranchCardActionsBar.svelte b/apps/staged/src/lib/features/branches/BranchCardActionsBar.svelte index af00398f..ad1f6d44 100644 --- a/apps/staged/src/lib/features/branches/BranchCardActionsBar.svelte +++ b/apps/staged/src/lib/features/branches/BranchCardActionsBar.svelte @@ -30,7 +30,7 @@ import SineWave from '../../shared/SineWave.svelte'; import ActionOutputModal from '../actions/ActionOutputModal.svelte'; import { listen, type UnlistenFn } from '@tauri-apps/api/event'; - import type { Branch } from '../../types'; + import type { Branch, ProjectRepo } from '../../types'; import * as commands from '../../api/commands'; import type { ProjectAction } from '../../api/commands'; import { @@ -58,7 +58,7 @@ interface Props { branch: Branch; - repoLabel?: { githubRepo: string; subpath: string | null; reason?: string | null } | null; + repoLabel?: ProjectRepo | null; isLocal: boolean; isRemote: boolean; remoteWorkspaceStatus: string | null; diff --git a/apps/staged/src/lib/features/branches/BranchCardHeaderInfo.svelte b/apps/staged/src/lib/features/branches/BranchCardHeaderInfo.svelte index 2a766f0f..3f9a0f07 100644 --- a/apps/staged/src/lib/features/branches/BranchCardHeaderInfo.svelte +++ b/apps/staged/src/lib/features/branches/BranchCardHeaderInfo.svelte @@ -1,10 +1,11 @@