Skip to content

refactor(ui): flatten repo cache and persist dismissed repo explanation#410

Merged
matt2e merged 3 commits intomainfrom
dismissed-repo-explanantion
Mar 18, 2026
Merged

refactor(ui): flatten repo cache and persist dismissed repo explanation#410
matt2e merged 3 commits intomainfrom
dismissed-repo-explanantion

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Mar 18, 2026

Summary

  • Flatten the per-project repoLabelsByProject nested map into a single reposById: Map<string, ProjectRepo> for simpler lookups and state management
  • Use the shared ProjectRepo type instead of inline object shapes for repoLabel props across BranchCard, BranchCardActionsBar, and BranchCardHeaderInfo
  • Add onDismissReason callback to update the in-memory repo cache when a user dismisses a repo explanation, so the change persists across project switches without a refetch

Test plan

  • Verify repo labels still display correctly on branch cards in multi-repo projects
  • Dismiss a repo explanation, switch to another project and back, confirm the explanation stays dismissed
  • Add a new repo to a project and confirm it appears in the repo labels

🤖 Generated with Claude Code

matt2e and others added 3 commits March 18, 2026 14:28
…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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
Use Svelte shorthand {onDismissReason} instead of wrapping in a
redundant arrow function, since the signature is identical.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt2e matt2e requested review from baxen and wesbillman as code owners March 18, 2026 03:57
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0acd4ad20

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +161 to +163
function repoForBranch(branch: Branch): ProjectRepo | null {
if (!branch.projectRepoId) return null;
return reposById.get(branch.projectRepoId) ?? null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore primary-repo fallback for legacy branches

repoForBranch now returns null whenever branch.projectRepoId is missing, but ProjectHome.svelte still has a delete fallback for "legacy branches without repo linkage", and the backend falls back to project.primary_repo() when project_repo_id is absent. For any project created before repo-linking was added, this strips the branch card of its repo badge/reason banner and leaves DiffModal without githubRepo/subpath, even though those branches are still valid. Preserve the old project.githubRepo/project.subpath fallback for unlinked branches.

Useful? React with 👍 / 👎.

@matt2e matt2e merged commit 74bed9f into main Mar 18, 2026
4 checks passed
@matt2e matt2e deleted the dismissed-repo-explanantion branch March 18, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant