refactor(ui): flatten repo cache and persist dismissed repo explanation#410
refactor(ui): flatten repo cache and persist dismissed repo explanation#410
Conversation
…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>
There was a problem hiding this comment.
💡 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".
| function repoForBranch(branch: Branch): ProjectRepo | null { | ||
| if (!branch.projectRepoId) return null; | ||
| return reposById.get(branch.projectRepoId) ?? null; |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
repoLabelsByProjectnested map into a singlereposById: Map<string, ProjectRepo>for simpler lookups and state managementProjectRepotype instead of inline object shapes forrepoLabelprops acrossBranchCard,BranchCardActionsBar, andBranchCardHeaderInfoonDismissReasoncallback to update the in-memory repo cache when a user dismisses a repo explanation, so the change persists across project switches without a refetchTest plan
🤖 Generated with Claude Code