Skip to content

🙌 OpenHands: AI-Driven Development

fix(frontend): chat suggestions disappear when “Push” is pressed before V1 conversation starts (#11494)

Hiep Leb8f387df942a
diff --git a/frontend/src/components/features/chat/git-control-bar-pr-button.tsx b/frontend/src/components/features/chat/git-control-bar-pr-button.tsx
index 53e60f886d..ea7b84c7e5 100644
--- a/frontend/src/components/features/chat/git-control-bar-pr-button.tsx
+++ b/frontend/src/components/features/chat/git-control-bar-pr-button.tsx
@@ -10,19 +10,22 @@ interface GitControlBarPrButtonProps {
onSuggestionsClick: (value: string) => void;
hasRepository: boolean;
currentGitProvider: Provider;
+ isConversationReady?: boolean;
}
export function GitControlBarPrButton({
onSuggestionsClick,
hasRepository,
currentGitProvider,
+ isConversationReady = true,
}: GitControlBarPrButtonProps) {
const { t } = useTranslation();
const { providers } = useUserProviders();
const providersAreSet = providers.length > 0;
- const isButtonEnabled = providersAreSet && hasRepository;
+ const isButtonEnabled =
+ providersAreSet && hasRepository && isConversationReady;
const handlePrClick = () => {
posthog.capture("create_pr_button_clicked");
diff --git a/frontend/src/components/features/chat/git-control-bar-pull-button.tsx b/frontend/src/components/features/chat/git-control-bar-pull-button.tsx
index c4a109e001..7adb9a4649 100644
--- a/frontend/src/components/features/chat/git-control-bar-pull-button.tsx
+++ b/frontend/src/components/features/chat/git-control-bar-pull-button.tsx
@@ -8,10 +8,12 @@ import { I18nKey } from "#/i18n/declaration";
interface GitControlBarPullButtonProps {
onSuggestionsClick: (value: string) => void;
+ isConversationReady?: boolean;
}
export function GitControlBarPullButton({
onSuggestionsClick,
+ isConversationReady = true,
}: GitControlBarPullButtonProps) {
const { t } = useTranslation();
@@ -20,7 +22,8 @@ export function GitControlBarPullButton({
const providersAreSet = providers.length > 0;
const hasRepository = conversation?.selected_repository;
- const isButtonEnabled = providersAreSet && hasRepository;
+ const isButtonEnabled =
+ providersAreSet && hasRepository && isConversationReady;
const handlePullClick = () => {
posthog.capture("pull_button_clicked");
diff --git a/frontend/src/components/features/chat/git-control-bar-push-button.tsx b/frontend/src/components/features/chat/git-control-bar-push-button.tsx
index b32a8fe83c..5c40bd845f 100644
--- a/frontend/src/components/features/chat/git-control-bar-push-button.tsx
+++ b/frontend/src/components/features/chat/git-control-bar-push-button.tsx
@@ -10,19 +10,22 @@ interface GitControlBarPushButtonProps {
onSuggestionsClick: (value: string) => void;
hasRepository: boolean;
currentGitProvider: Provider;
+ isConversationReady?: boolean;
}
export function GitControlBarPushButton({
onSuggestionsClick,
hasRepository,
currentGitProvider,
+ isConversationReady = true,
}: GitControlBarPushButtonProps) {
const { t } = useTranslation();
const { providers } = useUserProviders();
const providersAreSet = providers.length > 0;
- const isButtonEnabled = providersAreSet && hasRepository;
+ const isButtonEnabled =
+ providersAreSet && hasRepository && isConversationReady;
const handlePushClick = () => {
posthog.capture("push_button_clicked");
diff --git a/frontend/src/components/features/chat/git-control-bar.tsx b/frontend/src/components/features/chat/git-control-bar.tsx
index 78074eca58..551d1e79c7 100644
--- a/frontend/src/components/features/chat/git-control-bar.tsx
+++ b/frontend/src/components/features/chat/git-control-bar.tsx
@@ -6,6 +6,7 @@ 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 { useUnifiedWebSocketStatus } from "#/hooks/use-unified-websocket-status";
import { Provider } from "#/types/settings";
import { I18nKey } from "#/i18n/declaration";
import { GitControlBarTooltipWrapper } from "./git-control-bar-tooltip-wrapper";
@@ -19,6 +20,7 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
const { data: conversation } = useActiveConversation();
const { repositoryInfo } = useTaskPolling();
+ const webSocketStatus = useUnifiedWebSocketStatus();
// Priority: conversation data > task data
// This ensures we show repository info immediately from task, then transition to conversation data
@@ -31,6 +33,9 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
const hasRepository = !!selectedRepository;
+ // Enable buttons only when conversation exists and WS is connected
+ const isConversationReady = !!conversation && webSocketStatus === "CONNECTED";
+
return (
<div className="flex flex-row items-center">
<div className="flex flex-row gap-2.5 items-center overflow-x-auto flex-wrap md:flex-nowrap relative scrollbar-hide">
@@ -66,6 +71,7 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
>
<GitControlBarPullButton
onSuggestionsClick={onSuggestionsClick}
+ isConversationReady={isConversationReady}
/>
</GitControlBarTooltipWrapper>
@@ -78,6 +84,7 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
onSuggestionsClick={onSuggestionsClick}
hasRepository={hasRepository}
currentGitProvider={gitProvider}
+ isConversationReady={isConversationReady}
/>
</GitControlBarTooltipWrapper>
@@ -90,6 +97,7 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
onSuggestionsClick={onSuggestionsClick}
hasRepository={hasRepository}
currentGitProvider={gitProvider}
+ isConversationReady={isConversationReady}
/>
</GitControlBarTooltipWrapper>
</>