From bbdc4359281d69d26d941517c3049dcec3df7a6e Mon Sep 17 00:00:00 2001 From: Aanish Bhirud Date: Fri, 27 Mar 2026 14:06:05 -0400 Subject: [PATCH 1/2] feat: update document title when artifact is decoded Sets document.title to the active artifact's title (or envelope title) when a fragment is decoded, giving users meaningful browser tab labels instead of the static "agent-render" default. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/viewer-shell.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/viewer-shell.tsx b/src/components/viewer-shell.tsx index 31d50d6..274c8c0 100644 --- a/src/components/viewer-shell.tsx +++ b/src/components/viewer-shell.tsx @@ -279,6 +279,11 @@ export function ViewerShell() { const fragmentLength = hash.startsWith("#") ? hash.length - 1 : hash.length; const envelope = parsed.ok ? parsed.envelope : null; const activeArtifact = envelope ? getActiveArtifact(envelope) : null; + + useEffect(() => { + const title = activeArtifact?.title ?? envelope?.title; + document.title = title ? `${title} — agent-render` : "agent-render"; + }, [envelope, activeArtifact]); activeArtifactRef.current = activeArtifact; const markdownArtifact: MarkdownArtifact | null = activeArtifact?.kind === "markdown" ? activeArtifact : null; const codeArtifact: CodeArtifact | null = activeArtifact?.kind === "code" ? activeArtifact : null; From 0b6de66368c8abef55cdd4d2df26071e3794f374 Mon Sep 17 00:00:00 2001 From: Aanish Bhirud Date: Fri, 27 Mar 2026 14:42:16 -0400 Subject: [PATCH 2/2] fix: skip empty/whitespace-only titles in document.title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use .trim() || fallback instead of ?? so that empty-string titles don't produce a bare " — agent-render" browser tab label. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/viewer-shell.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/viewer-shell.tsx b/src/components/viewer-shell.tsx index 274c8c0..f0178a7 100644 --- a/src/components/viewer-shell.tsx +++ b/src/components/viewer-shell.tsx @@ -281,7 +281,7 @@ export function ViewerShell() { const activeArtifact = envelope ? getActiveArtifact(envelope) : null; useEffect(() => { - const title = activeArtifact?.title ?? envelope?.title; + const title = activeArtifact?.title?.trim() || envelope?.title?.trim(); document.title = title ? `${title} — agent-render` : "agent-render"; }, [envelope, activeArtifact]); activeArtifactRef.current = activeArtifact;