Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(frontend): display repository information after creating a V1 conversation (#11463)

Hiep Le1f35a73cc454
diff --git a/frontend/src/components/features/chat/git-control-bar.tsx b/frontend/src/components/features/chat/git-control-bar.tsx
index 045ac84283..78074eca58 100644
--- a/frontend/src/components/features/chat/git-control-bar.tsx
+++ b/frontend/src/components/features/chat/git-control-bar.tsx
@@ -5,6 +5,7 @@ import { GitControlBarPullButton } from "./git-control-bar-pull-button";
import { GitControlBarPushButton } from "./git-control-bar-push-button";
import { GitControlBarPrButton } from "./git-control-bar-pr-button";
import { useActiveConversation } from "#/hooks/query/use-active-conversation";
+import { useTaskPolling } from "#/hooks/query/use-task-polling";
import { Provider } from "#/types/settings";
import { I18nKey } from "#/i18n/declaration";
import { GitControlBarTooltipWrapper } from "./git-control-bar-tooltip-wrapper";
@@ -17,10 +18,16 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
const { t } = useTranslation();
const { data: conversation } = useActiveConversation();
+ const { repositoryInfo } = useTaskPolling();
- const selectedRepository = conversation?.selected_repository;
- const gitProvider = conversation?.git_provider as Provider;
- const selectedBranch = conversation?.selected_branch;
+ // Priority: conversation data > task data
+ // This ensures we show repository info immediately from task, then transition to conversation data
+ const selectedRepository =
+ conversation?.selected_repository || repositoryInfo?.selectedRepository;
+ const gitProvider = (conversation?.git_provider ||
+ repositoryInfo?.gitProvider) as Provider;
+ const selectedBranch =
+ conversation?.selected_branch || repositoryInfo?.selectedBranch;
const hasRepository = !!selectedRepository;
diff --git a/frontend/src/hooks/query/use-task-polling.ts b/frontend/src/hooks/query/use-task-polling.ts
index 81dc3e7aa4..94aced8c26 100644
--- a/frontend/src/hooks/query/use-task-polling.ts
+++ b/frontend/src/hooks/query/use-task-polling.ts
@@ -68,5 +68,11 @@ export const useTaskPolling = () => {
taskDetail: taskQuery.data?.detail,
taskError: taskQuery.error,
isLoadingTask: taskQuery.isLoading,
+ // Repository information from task request
+ repositoryInfo: {
+ selectedRepository: taskQuery.data?.request?.selected_repository,
+ selectedBranch: taskQuery.data?.request?.selected_branch,
+ gitProvider: taskQuery.data?.request?.git_provider,
+ },
};
};