All checks pass. Here's a summary of the changes made: (#1595)
## Summary Fixed the regression where the Create PR dialog was defaulting to the repository's current checked-out branch (`is_current`) instead of the task attempt's configured target branch. ### Changes Made 1. **`frontend/src/components/dialogs/tasks/CreatePRDialog.tsx`**: - Added `targetBranch?: string` to the props interface - Destructured `targetBranch` in the component - Updated the default branch selection logic to prioritize `targetBranch` over `is_current` 2. **`frontend/src/components/tasks/Toolbar/GitOperations.tsx`**: - Pass `targetBranch: getSelectedRepoStatus()?.target_branch_name` when showing the dialog ### Behavior - When opening the Create PR dialog, it now defaults to the attempt's target branch (from `RepoBranchStatus.target_branch_name`) - Falls back to the current branch (`is_current`) only if the target branch is not set or not found in the branch list - This restores the original intended behavior that was lost during the multi-repo refactor
This commit is contained in:
committed by
GitHub
parent
adf759fbbe
commit
5810c7cccf
@@ -38,10 +38,11 @@ interface CreatePRDialogProps {
|
||||
attempt: TaskAttempt;
|
||||
task: TaskWithAttemptStatus;
|
||||
repoId: string;
|
||||
targetBranch?: string;
|
||||
}
|
||||
|
||||
const CreatePRDialogImpl = NiceModal.create<CreatePRDialogProps>(
|
||||
({ attempt, task, repoId }) => {
|
||||
({ attempt, task, repoId, targetBranch }) => {
|
||||
const modal = useModal();
|
||||
const { t } = useTranslation('tasks');
|
||||
const { isLoaded } = useAuth();
|
||||
@@ -84,12 +85,18 @@ const CreatePRDialogImpl = NiceModal.create<CreatePRDialogProps>(
|
||||
// Set default base branch when branches are loaded
|
||||
useEffect(() => {
|
||||
if (branches.length > 0 && !prBaseBranch) {
|
||||
// First priority: use the target branch from attempt config
|
||||
if (targetBranch && branches.some((b) => b.name === targetBranch)) {
|
||||
setPrBaseBranch(targetBranch);
|
||||
return;
|
||||
}
|
||||
// Fallback: use the current branch
|
||||
const currentBranch = branches.find((b) => b.is_current);
|
||||
if (currentBranch) {
|
||||
setPrBaseBranch(currentBranch.name);
|
||||
}
|
||||
}
|
||||
}, [branches, prBaseBranch]);
|
||||
}, [branches, prBaseBranch, targetBranch]);
|
||||
|
||||
const isMacEnvironment = useMemo(
|
||||
() => environment?.os_type?.toLowerCase().includes('mac'),
|
||||
|
||||
@@ -254,6 +254,7 @@ function GitOperations({
|
||||
attempt: selectedAttempt,
|
||||
task,
|
||||
repoId: getSelectedRepoId(),
|
||||
targetBranch: getSelectedRepoStatus()?.target_branch_name,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user