@@ -35,7 +35,10 @@ import {
3535 resolvePreviousWorktreeSeed ,
3636 shouldShowEnvironmentIndicator ,
3737} from "./BranchToolbar.logic" ;
38- import { BranchToolbarBranchSelector } from "./BranchToolbarBranchSelector" ;
38+ import {
39+ BranchToolbarBranchSelector ,
40+ type BranchToolbarBranchSelectorHandle ,
41+ } from "./BranchToolbarBranchSelector" ;
3942import { BranchToolbarEnvironmentSelector } from "./BranchToolbarEnvironmentSelector" ;
4043import { BranchToolbarEnvModeSelector } from "./BranchToolbarEnvModeSelector" ;
4144import { Button } from "./ui/button" ;
@@ -57,6 +60,7 @@ import { resolveRestingComposerControlsNaturalWidth } from "./composerFooterLayo
5760import { cn } from "~/lib/utils" ;
5861
5962export interface BranchToolbarHandle {
63+ openBranchPicker : ( ) => void ;
6064 usePreviousWorktree : ( ) => void ;
6165}
6266
@@ -478,6 +482,7 @@ export const BranchToolbar = memo(function BranchToolbar({
478482 composerControlsHostRef,
479483 contextStripVisible = true ,
480484} : BranchToolbarProps ) {
485+ const branchSelectorRef = useRef < BranchToolbarBranchSelectorHandle > ( null ) ;
481486 const threadRef = useMemo (
482487 ( ) => scopeThreadRef ( environmentId , threadId ) ,
483488 [ environmentId , threadId ] ,
@@ -541,6 +546,7 @@ export const BranchToolbar = memo(function BranchToolbar({
541546 useImperativeHandle (
542547 ref ,
543548 ( ) => ( {
549+ openBranchPicker : ( ) => branchSelectorRef . current ?. open ( ) ,
544550 usePreviousWorktree : ( ) => {
545551 if ( ! showGitControls || ! canUsePreviousWorktree || ! previousWorktreeSeed ) return ;
546552 onUsePreviousWorktree ( ) ;
@@ -656,6 +662,7 @@ export const BranchToolbar = memo(function BranchToolbar({
656662
657663 { showGitControls ? (
658664 < BranchToolbarBranchSelector
665+ ref = { branchSelectorRef }
659666 className = "min-w-0 flex-initial justify-end @3xl/composer-surface:ml-auto"
660667 environmentId = { environmentId }
661668 threadId = { threadId }
0 commit comments