diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/CommitInput/CommitInput.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/CommitInput/CommitInput.tsx index 5ffa60369f0..5f363a251c5 100644 --- a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/CommitInput/CommitInput.tsx +++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/CommitInput/CommitInput.tsx @@ -102,8 +102,19 @@ export function CommitInput({ commitMutation.mutate({ worktreePath, message: commitMessage.trim() }); }; - const handlePush = () => - pushMutation.mutate({ worktreePath, setUpstream: true }); + const handlePush = () => { + const isPublishing = !hasUpstream; + pushMutation.mutate( + { worktreePath, setUpstream: true }, + { + onSuccess: () => { + if (isPublishing) { + createPRMutation.mutate({ worktreePath }); + } + }, + }, + ); + }; const handlePull = () => pullMutation.mutate({ worktreePath }); const handleSync = () => syncMutation.mutate({ worktreePath }); const handleCreatePR = () => createPRMutation.mutate({ worktreePath });