@@ -1008,8 +1008,6 @@ export default function GitActionsControl({
10081008 const [ inlineSuccess , setInlineSuccess ] = useState < InlineGitActionSuccess | null > ( null ) ;
10091009 const [ pendingDefaultBranchAction , setPendingDefaultBranchAction ] =
10101010 useState < PendingDefaultBranchAction | null > ( null ) ;
1011- // Keep the payload until the dialog finishes closing.
1012- const [ isDefaultBranchDialogOpen , setIsDefaultBranchDialogOpen ] = useState ( false ) ;
10131011 const sourceControlScope = { environmentId : activeEnvironmentId , cwd : gitCwd } ;
10141012 const vcsActionState = useAtomValue ( vcsActionManager . stateAtom ( sourceControlScope ) ) ;
10151013 const visibleInlineSuccess = inlineSuccess ?. scopeKey === successScopeKey ? inlineSuccess : null ;
@@ -1252,7 +1250,6 @@ export default function GitActionsControl({
12521250 ...( onConfirmed ? { onConfirmed } : { } ) ,
12531251 ...( filePaths ? { filePaths } : { } ) ,
12541252 } ) ;
1255- setIsDefaultBranchDialogOpen ( true ) ;
12561253 return ;
12571254 }
12581255 onConfirmed ?.( ) ;
@@ -1363,11 +1360,11 @@ export default function GitActionsControl({
13631360 }
13641361
13651362 const continuePendingDefaultBranchAction = ( featureBranch : boolean ) => {
1366- if ( ! isDefaultBranchDialogOpen || ! pendingDefaultBranchAction || ! canWriteSourceControl ) return ;
1363+ if ( ! pendingDefaultBranchAction || ! canWriteSourceControl ) return ;
13671364 if ( featureBranch && ( ! canChangeThreadBranch || featureBranchUnavailableReason !== null ) )
13681365 return ;
13691366 const { action, commitMessage, onConfirmed, filePaths } = pendingDefaultBranchAction ;
1370- setIsDefaultBranchDialogOpen ( false ) ;
1367+ setPendingDefaultBranchAction ( null ) ;
13711368 void runGitActionWithToast ( {
13721369 action,
13731370 ...( commitMessage ? { commitMessage } : { } ) ,
@@ -2033,9 +2030,8 @@ export default function GitActionsControl({
20332030 />
20342031
20352032 < Dialog
2036- open = { isDefaultBranchDialogOpen }
2037- onOpenChange = { setIsDefaultBranchDialogOpen }
2038- onOpenChangeComplete = { ( open ) => {
2033+ open = { pendingDefaultBranchAction !== null }
2034+ onOpenChange = { ( open ) => {
20392035 if ( ! open ) setPendingDefaultBranchAction ( null ) ;
20402036 } }
20412037 >
@@ -2054,7 +2050,7 @@ export default function GitActionsControl({
20542050 className = "w-full sm:mr-auto sm:w-auto"
20552051 variant = "outline"
20562052 size = "sm"
2057- onClick = { ( ) => setIsDefaultBranchDialogOpen ( false ) }
2053+ onClick = { ( ) => setPendingDefaultBranchAction ( null ) }
20582054 >
20592055 Abort
20602056 </ Button >
0 commit comments