Repository navigation
Fix document title updates on SPA navigation - #805
Merged
Merged
Conversation
SSR set <title> once, but the client router never updated document.title after pushState navigations. Add a shared route title registry and apply it from the router on every committed navigation so titles stay in sync without per-route wiring.
kody-bot
marked this pull request as ready for review
July 20, 2026 18:06
📝 WalkthroughWalkthroughChangesDocument title synchronization
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ClientRouter
participant applyDocumentTitle
participant resolveDocumentTitle
participant BrowserDocument
ClientRouter->>applyDocumentTitle: pathname and loader data
applyDocumentTitle->>resolveDocumentTitle: resolve title
resolveDocumentTitle-->>applyDocumentTitle: document title
applyDocumentTitle->>BrowserDocument: assign document.title
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Contributor
|
🔎 Preview deployed: https://kody-pr-805.kody-a99.workers.dev Worker: Mocks:
|
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
document.titlebecause<title>is set only during SSR outside the hydrated#roottree.resolveDocumentTitle) and apply it from the client router on every committed navigation, including dynamic titles derived from loader data (blog posts, profiles, community packages).document.titlewiring — titles update automatically from one place in the navigation pipeline.Test plan
document-title,ssr-render,client-router)System recap — extends existing primitives (medium risk)
Mode: recap · Base:
main@00a5fcb4· Head:89f1c7e6Classification: extends — client router now syncs
document.titleon SPA navigations via a shared title registry.Primitives touched
app-uicommunity-listingsnamefor title resolutionSystem map
Document titles now resolve from a shared registry at SSR fallback and on every client-router navigation commit.
Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Change flow
Before / after
<title>correctdocument.titlestuck on first pageSummary by CodeRabbit
New Features
Bug Fixes