fix: dont autofocus ghost chat input on mobile (#178)

closes https://github.com/better-auth/better-hub/issues/139
This commit is contained in:
Maxwell
2026-02-27 12:10:06 +10:00
committed by GitHub
parent 95cd234539
commit c7a65939e4
@@ -6,6 +6,7 @@ import { X, Code2, ChevronRight, Ghost, Plus } from "lucide-react";
import { cn } from "@/lib/utils";
import { AIChat } from "@/components/shared/ai-chat";
import { useGlobalChat, type InlineContext } from "@/components/shared/global-chat-provider";
import { useIsMobile } from "@/hooks/use-is-mobile";
import {
searchRepoFiles,
fetchFileContentForContext,
@@ -177,6 +178,7 @@ export function GlobalChatPanel() {
const prevContextKeyRef = useRef<string | null>(null);
const pathname = usePathname();
const searchParams = useSearchParams();
const isMobile = useIsMobile();
// Defer rendering until after hydration — this panel starts hidden (translate-x-full)
// and depends on client-only state (chat history, persisted context), so SSR is pointless
@@ -697,7 +699,10 @@ export function GlobalChatPanel() {
hashMentionPrFiles={
mentionableFiles
}
autoFocus={isActive}
autoFocus={
isActive &&
!isMobile
}
historyItems={ghostHistory}
onLoadHistory={
handleLoadHistory