Skip to content

Commit 8bceee9

Browse files
frontend: update browser tab title with conversation title (#7694)
Co-authored-by: openhands <[email protected]>
1 parent e8fe9ae commit 8bceee9

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

frontend/src/context/conversation-context.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export function ConversationProvider({
2424

2525
const value = useMemo(() => ({ conversationId }), [conversationId]);
2626

27-
return <ConversationContext value={value}>{children}</ConversationContext>;
27+
return (
28+
<ConversationContext.Provider value={value}>
29+
{children}
30+
</ConversationContext.Provider>
31+
);
2832
}
2933

3034
export function useConversation() {

frontend/src/hooks/use-document-title-from-state.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function useDocumentTitleFromState(suffix = "OpenHands") {
1818
useEffect(() => {
1919
if (conversation?.title) {
2020
lastValidTitleRef.current = conversation.title;
21-
document.title = `${conversation.title} - ${suffix}`;
21+
document.title = `${conversation.title} | ${suffix}`;
2222
} else {
2323
document.title = suffix;
2424
}

frontend/src/routes/_oh.app/route.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { useSettings } from "#/hooks/query/use-settings";
3636
import { clearFiles, clearInitialPrompt } from "#/state/initial-query-slice";
3737
import { RootState } from "#/store";
3838
import { displayErrorToast } from "#/utils/custom-toast-handlers";
39+
import { useDocumentTitleFromState } from "#/hooks/use-document-title-from-state";
3940

4041
function AppContent() {
4142
useConversationConfig();
@@ -51,6 +52,9 @@ function AppContent() {
5152
const dispatch = useDispatch();
5253
const endSession = useEndSession();
5354

55+
// Set the document title to the conversation title when available
56+
useDocumentTitleFromState();
57+
5458
const [width, setWidth] = React.useState(window.innerWidth);
5559

5660
const secrets = React.useMemo(

0 commit comments

Comments
 (0)