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,
|
useWindowDimensions,
|
||||||
LayoutChangeEvent,
|
LayoutChangeEvent,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
|
Platform,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||||
import { useFocusEffect } from "@react-navigation/native";
|
import { useFocusEffect } from "@react-navigation/native";
|
||||||
@@ -357,6 +358,14 @@ function AgentScreenContent({ serverId, agentId, onBack }: AgentScreenContentPro
|
|||||||
initializeAgent({ agentId: resolvedAgentId });
|
initializeAgent({ agentId: resolvedAgentId });
|
||||||
}, [resolvedAgentId, initializeAgent, isInitializingFromMap]);
|
}, [resolvedAgentId, initializeAgent, isInitializingFromMap]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (Platform.OS !== "web") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const title = agent?.title || "Agent";
|
||||||
|
document.title = title;
|
||||||
|
}, [agent?.title]);
|
||||||
|
|
||||||
const recalculateMenuPosition = useCallback(
|
const recalculateMenuPosition = useCallback(
|
||||||
(onMeasured?: () => void) => {
|
(onMeasured?: () => void) => {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user