π OpenHands: AI-Driven Development
frontend: update browser tab title with conversation title (#7694)
Xingyao Wang8bceee9e42b3
diff --git a/frontend/src/context/conversation-context.tsx b/frontend/src/context/conversation-context.tsxindex 86f5398b78..748ee8ea0a 100644--- a/frontend/src/context/conversation-context.tsx+++ b/frontend/src/context/conversation-context.tsx@@ -24,7 +24,11 @@ export function ConversationProvider({const value = useMemo(() => ({ conversationId }), [conversationId]);- return <ConversationContext value={value}>{children}</ConversationContext>;+ return (+ <ConversationContext.Provider value={value}>+ {children}+ </ConversationContext.Provider>+ );}export function useConversation() {diff --git a/frontend/src/hooks/use-document-title-from-state.ts b/frontend/src/hooks/use-document-title-from-state.tsindex 92021a3234..aaf968bf80 100644--- a/frontend/src/hooks/use-document-title-from-state.ts+++ b/frontend/src/hooks/use-document-title-from-state.ts@@ -18,7 +18,7 @@ export function useDocumentTitleFromState(suffix = "OpenHands") {useEffect(() => {if (conversation?.title) {lastValidTitleRef.current = conversation.title;- document.title = `${conversation.title} - ${suffix}`;+ document.title = `${conversation.title} | ${suffix}`;} else {document.title = suffix;}diff --git a/frontend/src/routes/_oh.app/route.tsx b/frontend/src/routes/_oh.app/route.tsxindex dd8b94e1a6..13fce1192a 100644--- a/frontend/src/routes/_oh.app/route.tsx+++ b/frontend/src/routes/_oh.app/route.tsx@@ -36,6 +36,7 @@ import { useSettings } from "#/hooks/query/use-settings";import { clearFiles, clearInitialPrompt } from "#/state/initial-query-slice";import { RootState } from "#/store";import { displayErrorToast } from "#/utils/custom-toast-handlers";+import { useDocumentTitleFromState } from "#/hooks/use-document-title-from-state";function AppContent() {useConversationConfig();@@ -51,6 +52,9 @@ function AppContent() {const dispatch = useDispatch();const endSession = useEndSession();+ // Set the document title to the conversation title when available+ useDocumentTitleFromState();+const [width, setWidth] = React.useState(window.innerWidth);const secrets = React.useMemo(