feat(grove): custom base branch per project#55
Merged
bang9 merged 21 commits intobang9:mainfrom Mar 30, 2026
Merged
Conversation
Adds baseBranch/resolvedDefaultBranch to Project TypeScript type, IPC wrappers for getRemoteBranches and setBaseBranch, Zustand store action, BranchSelector searchable dropdown component, and integrates branch selection into DefaultBranchItem using main's SidebarLeafItem architecture.
Use createPortal to render the dropdown at document.body with fixed positioning based on the trigger element's bounding rect, so it is not clipped by parent overflow containers in the sidebar.
- Show actual branch name in default option (e.g. "main (default)") instead of generic "Auto-detect (default)" - Fix sidebar not updating immediately after changing base branch by also updating resolvedDefaultBranch in the store - Add (source) label next to branch name in sidebar
resolvedDefaultBranch now ignores user-set baseBranch and always reflects the actual git remote default. Sidebar displays baseBranch ?? resolvedDefaultBranch. The dropdown default option correctly shows the git default (e.g. "dev (default)") even when the user has overridden the base branch to something else.
Replace clickable branch name with a dedicated ChevronDown button placed between (source) label and the refresh button. Shows on hover, positioned via the status slot in SidebarLeafItem.
Use ArrowLeftRight icon inline after "(source)" text instead of in the status slot. Shows on hover, conveys branch switching intent.
Place ArrowLeftRight button in the action slot alongside the refresh button. Add cursor-pointer to both buttons.
bang9
reviewed
Mar 29, 2026
Owner
bang9
left a comment
There was a problem hiding this comment.
Code Review
전반적으로 구조가 잘 잡혀 있고, 기존 패턴(SidebarLeafItem, Tauri command, Zustand store)을 잘 따르고 있습니다.
인라인 코멘트들 확인 부탁드려요.
주요 지적 사항
성능 (High)
remote_default_branch이중 호출 — 프로젝트당 git subprocess 추가git fetch originthrottle 미적용 — 기존maybe_fetch_source_remote패턴 우회
동작 안정성
- stale
base_branch시add_worktree_impl에서 fallback 없음
테스트
- 새 동작에 대한 테스트가 0건입니다. 특히 아래 항목은 추가가 필요합니다:
set_base_branch_implhappy path / invalid branch 거부 / None 초기화add_worktree_impl이 설정된base_branch를 실제로 사용하는지 (PR 핵심 동작)- config round-trip (serde 영속성)
- Rust 쪽에
TestHome,create_bare_remote패턴이 이미 있으므로 작성이 수월할 것입니다.
Owner
Code Review Summary전반적으로 구조가 잘 잡혀 있고, 기존 패턴(SidebarLeafItem, Tauri command, Zustand store)을 잘 따르고 있습니다. |
bang9
reviewed
Mar 29, 2026
bang9
reviewed
Mar 29, 2026
Performance: - Deduplicate remote_default_branch() call in project_from_entry by passing the resolved value to check_source_behind_remote - Use maybe_fetch_source_remote() throttle in get_remote_branches_impl instead of unconditional git fetch Robustness: - add_worktree_impl validates configured base branch exists on remote before use, falls back to auto-detect with warning if stale Bug: - Add getRemoteBranches/setBaseBranch stubs to electron.ts Code quality: - BranchSelector: unify fetchBranches into single function used by both initial load and retry - Use onCloseRef pattern to avoid re-registering click-outside listener - Add resize listener to reposition portal dropdown - Filter resolvedDefaultBranch from branch list to avoid duplicate with the "(default)" option Tests: - set_base_branch_impl happy path, invalid branch rejection, None reset - add_worktree_impl uses configured base branch (verifies commit from develop branch, not main) - config round-trip preserves base_branch field (Some and None)
bang9
reviewed
Mar 30, 2026
The mousedown outside-click handler was closing the dropdown before the toggle button's onClick could fire, causing the selector to immediately reopen. Adding anchorRef to the exclusion check lets the toggle button properly close the dropdown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Stale remote tracking refs for deleted branches were not being cleaned up, causing show-ref --verify to succeed and preventing the fallback-to-auto-detect logic from working correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…default) Show "(base·default)" when using auto-detected default branch, "(base)" when a custom base branch is set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config.json에 영속 저장, 기존 worktree에는 영향 없음Changes
Backend (Rust)
ProjectEntry/Project에base_branch: Option<String>,resolved_default_branch: String필드 추가get_remote_branches,set_base_branchTauri command 추가add_worktree_impl에서 config base branch 우선 사용Frontend (React/TypeScript)
BranchSelectorsearchable dropdown 컴포넌트 (portal 기반, overflow 안전)DefaultBranchItem에 branch switch 버튼 통합 (SidebarLeafItem 패턴)setBaseBranchZustand store action + IPC wrapperresolvedDefaultBranch는 항상 git remote default를 반환,baseBranch는 사용자 오버라이드