Skip to content

feat: update document title when artifact is decoded#20

Merged
baanish merged 2 commits intomainfrom
claude/dynamic-document-title
Apr 3, 2026
Merged

feat: update document title when artifact is decoded#20
baanish merged 2 commits intomainfrom
claude/dynamic-document-title

Conversation

@baanish
Copy link
Copy Markdown
Owner

@baanish baanish commented Mar 27, 2026

Summary

  • Sets document.title to the active artifact's title (or envelope title) when a fragment is decoded
  • Falls back to the default "agent-render" when no title is available
  • Gives users meaningful browser tab labels instead of a static default

Test plan

  • Load a fragment with an artifact that has a title field — verify the browser tab shows "<title> — agent-render"
  • Load a fragment with an envelope-level title but no artifact title — verify the envelope title is used
  • Load a fragment with no title at any level — verify the tab shows "agent-render"
  • Navigate between fragments — verify the title updates dynamically

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Document titles now dynamically update to reflect the currently active artifact, making browser tabs easier to identify.
    • When an active artifact lacks a title, the containing item's title is used; a sensible default is shown if no title is available.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1dcb2adf-52e0-4b29-93a4-dec624eb6f02

📥 Commits

Reviewing files that changed from the base of the PR and between 67c790e and 0b6de66.

📒 Files selected for processing (1)
  • src/components/viewer-shell.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/viewer-shell.tsx

📝 Walkthrough

Walkthrough

Added a useEffect to ViewerShell that updates document.title when envelope or activeArtifact change, preferring a trimmed activeArtifact.title, then envelope.title, and falling back to "agent-render".

Changes

Cohort / File(s) Summary
Document Title Management
src/components/viewer-shell.tsx
Added a useEffect hook to synchronize document.title with a trimmed activeArtifact.title or envelope.title, defaulting to "agent-render" when neither provides a non-empty string.

Sequence Diagram(s)

(No sequence diagrams generated — change is a single-component UI effect.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰
I hopped through props and nudged the light,
Trimmed the titles till they shone just right,
When artifacts whisper or envelopes stay mute,
I set the head so the page wears its suit,
A tiny rabbit—document.title in delight.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding dynamic document title updates based on artifact or envelope titles when decoded.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/dynamic-document-title

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Mar 27, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/components/viewer-shell.tsx
  • src/lib/payload/schema.ts

Changes from previous review:
This PR includes a major visual redesign (new color palette, typography, component structure) and a functional feature to update document.title when artifacts are decoded.

The fragment budget limit was increased from 8000 to 8192 characters across all documentation and code.

No issues found in the new changes.


Reviewed by minimax-m2.5 · 644,566 tokens

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 27, 2026

Deploying agent-render with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0b6de66
Status: ✅  Deploy successful!
Preview URL: https://cf2ce622.agent-render.pages.dev
Branch Preview URL: https://claude-dynamic-document-titl.agent-render.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/viewer-shell.tsx`:
- Around line 283-286: The current useEffect uses the nullish-coalescing
operator with activeArtifact?.title ?? envelope?.title which treats an empty
string as a valid title; change the logic in the useEffect to pick the first
non-empty trimmed title from activeArtifact.title, then envelope.title, and
finally the literal "agent-render" (e.g., compute a title by checking
activeArtifact?.title?.trim() and envelope?.title?.trim() and falling back to
"agent-render"), then assign that to document.title; reference the useEffect
block and the activeArtifact, envelope, and document.title identifiers when
making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd212d02-01c2-4161-90b9-c4cd374a50cd

📥 Commits

Reviewing files that changed from the base of the PR and between 3d5ed45 and 5a63947.

📒 Files selected for processing (1)
  • src/components/viewer-shell.tsx

baanish and others added 2 commits April 3, 2026 16:06
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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
@baanish baanish force-pushed the claude/dynamic-document-title branch from 67c790e to 0b6de66 Compare April 3, 2026 20:06
@baanish baanish merged commit 6f3bb0b into main Apr 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant