fix: auto-fetch branches when opening create worktree dialog (#1572)
* repro: add test reproducing issue #1564 - empty branch list in create worktree dialog The NewWorktreeDialog does not auto-fetch branches when it opens if branches haven't been cached yet. Branches only get populated if the Git tab has been opened or a draft session has been started, both of which call fetchBranches/fetchAll independently. The test demonstrates: 1. Branches are null (empty list) for directories not yet fetched 2. Branches are available after fetchBranches is called 3. The ChatInput's draft session branch fetch explains why the issue says 'list gets populated after starting a draft session' 4. The missing auto-fetch call when dialog opens * fix: auto-fetch branches when opening create worktree dialog --------- Co-authored-by: Reproduction Bot <repro-bot@openchamber.dev>
This commit is contained in:
committed by
GitHub
co-authored by
Reproduction Bot
parent
b8dc25c7c8
commit
e74ce993d5
@@ -359,6 +359,12 @@ export function NewWorktreeDialog({
|
||||
void fetchBranches(projectDirectory, git);
|
||||
}, [projectDirectory, git, fetchBranches]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!open || !projectDirectory || !git) return;
|
||||
if (branches?.all) return;
|
||||
void fetchBranches(projectDirectory, git);
|
||||
}, [open, projectDirectory, git, branches?.all, fetchBranches]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!existingBranchDropdownOpen && !existingBranchPickerOpen) {
|
||||
setExistingBranchQuery('');
|
||||
|
||||
Reference in New Issue
Block a user