Set document title on agent screen for web
Adds a useEffect that sets the browser tab title to the agent's title (or "Agent" as fallback) when viewing an agent. Only runs on web platform. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
3146533438
commit
8261910c37
@@ -8,6 +8,7 @@ import {
|
||||
useWindowDimensions,
|
||||
LayoutChangeEvent,
|
||||
ScrollView,
|
||||
Platform,
|
||||
} from "react-native";
|
||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||
import { useFocusEffect } from "@react-navigation/native";
|
||||
@@ -357,6 +358,14 @@ function AgentScreenContent({ serverId, agentId, onBack }: AgentScreenContentPro
|
||||
initializeAgent({ agentId: resolvedAgentId });
|
||||
}, [resolvedAgentId, initializeAgent, isInitializingFromMap]);
|
||||
|
||||
useEffect(() => {
|
||||
if (Platform.OS !== "web") {
|
||||
return;
|
||||
}
|
||||
const title = agent?.title || "Agent";
|
||||
document.title = title;
|
||||
}, [agent?.title]);
|
||||
|
||||
const recalculateMenuPosition = useCallback(
|
||||
(onMeasured?: () => void) => {
|
||||
requestAnimationFrame(() => {
|
||||
|
||||
Reference in New Issue
Block a user