You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: update document titles on route changes - #469
Navigating between pages currently keeps the static index.html title. This updates the browser title to match the active route, including the username on contributor profiles and the 404 fallback.
A small DocumentTitle component uses React Router's existing matching rules and is mounted once in App. It handles complete paths, decoded usernames and redirects without adding dependencies.
Screenshots/Recordings:
Local browser verification on Windows:
Action
Observed browser title
Open Home
OrgExplorer — Home
Navigate to Settings
Settings — OrgExplorer
Navigate to Support Us
Support Us — OrgExplorer
Back / Forward
Settings / Support Us titles restored
Open Overview without analysis
OrgExplorer — Home after redirect
Open /settings/extra
404 Not Found — OrgExplorer
The screenshot below shows the resulting 404 page; the titles above were checked separately through the browser title API.
Additional Notes:
All 18 new integration cases pass. They failed against the static-title baseline and cover the requested routes, profile changes, query/hash/trailing-slash variants, history navigation, unknown nested paths and the existing analysis guard.
Node 22.23.5 build passes, with the bundle-size warning and plugin-timing diagnostic.
No actionable comments were generated in the recent review.
Walkthrough
The application now sets document.title according to the active route. Contributor profile titles include the username, and unmatched paths use a 404 title. Tests cover route titles and title changes during navigation.
Changes
Route-Based Document Titles
Layer / File(s)
Summary
Route title selection and update src/components/DocumentTitle.jsx
A new component matches the current path to a static or username-based title, uses a 404 title for unmatched paths, and updates document.title.
App integration and route title tests src/App.jsx, src/App.titles.test.jsx
AppContent renders DocumentTitle before the routes. Tests check titles across routes, query strings, fragments, case and encoding variants, profile history navigation, unmatched paths, and an analysis-guard redirect.
sequenceDiagram
participant Router
participant AppContent
participant DocumentTitle
participant Browser
AppContent->>DocumentTitle: renders title component
Router->>DocumentTitle: provides current pathname
DocumentTitle->>Browser: updates document.title
Loading
Suggested labels: Typescript Lang
Merge Risk: Minimal · up to 4cfcc
This change sets the browser tab title for each route, including contributor usernames and a 404 fallback. It is low risk and easy to reverse, and no merge-blocking issues were found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "feat: update document titles on route changes" matches the main change. The PR adds a DocumentTitle component that sets document.title per route, mounts it once in App, and adds route tests…
Linked Issues check
Issue #462 requires a route-specific document.title for each listed route. At the reviewed head, src/components/DocumentTitle.jsx defines a title entry for each route: '/' (Home), '/overview', '/repos…
Out of Scope Changes check
The whole-PR changes (merge base b396d1b to head 4cfccbe) touch three areas: src/components/DocumentTitle.jsx (new title logic), src/App.jsx (+2 lines: import and mount of DocumentTitle), and src/App.…
Full details: Title check
Explanation
The title "feat: update document titles on route changes" matches the main change. The PR adds a DocumentTitle component that sets document.title per route, mounts it once in App, and adds route tests. The title is specific and concise, and it names the primary change from the developer's perspective.
Full details: Linked Issues check
Explanation
Issue #462 requires a route-specific document.title for each listed route. At the reviewed head, src/components/DocumentTitle.jsx defines a title entry for each route: '/' (Home), '/overview', '/repositories', '/contributors', '/contributors/:username' (username from decoded router params, formatted as '{username} — Contributor Profile — OrgExplorer'), '/network' ('Network Graph — OrgExplorer'), '/analytics', '/governance' ('Governance Audit — OrgExplorer'), '/settings', '/support-us', and '*' ('404 Not Found — OrgExplorer'). The component reads the location with useLocation, resolves the entry with matchRoutes, and sets document.title in a useEffect keyed on the title. src/App.jsx mounts <DocumentTitle /> once inside AppContent, so it runs for all routes, including redirects, because it follows the current location. The added tests in src/App.titles.test.jsx cover the listed routes, profile changes, query/hash/trailing-slash variants, history navigation, and unknown nested paths. The author reports these 18 cases pass. I did not run the tests. The implementation meets the coding requirements of #462. The issue permits either a shared hook or per-page effects, so the chosen approach is acceptable.
Full details: Out of Scope Changes check
Explanation
The whole-PR changes (merge base b396d1b to head 4cfccbe) touch three areas: src/components/DocumentTitle.jsx (new title logic), src/App.jsx (+2 lines: import and mount of DocumentTitle), and src/App.titles.test.jsx (new tests for the title behavior). Each change supports the title objective. The PR does not alter data fetching, PAT handling, or caching, as the description states, and the diff summary shows no unrelated edits. No out-of-scope change was found.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit hops past tabs at night, Each page now wears its title right. A profile name appears in view, A 404 title joins the queue. Back and forward change the scene, The rabbit nibbles something green.
Reviewing files that changed from the base of the PR and between b396d1b and 4cfccbe.
Files selected for processing: 3
src/App.jsx
src/App.titles.test.jsx
src/components/DocumentTitle.jsx
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
Addressed Issues:
Fixes #462
Navigating between pages currently keeps the static
index.htmltitle. This updates the browser title to match the active route, including the username on contributor profiles and the 404 fallback.A small
DocumentTitlecomponent uses React Router's existing matching rules and is mounted once in App. It handles complete paths, decoded usernames and redirects without adding dependencies.Screenshots/Recordings:
Local browser verification on Windows:
/settings/extraThe screenshot below shows the resulting 404 page; the titles above were checked separately through the browser title API.
Additional Notes:
ResizeObserver([BUG]: Missing ResizeObserver guard in Navbar causes App.test.jsx test suite failure under jsdom #456 / fix(navbar): guard ResizeObserver for jsdom test environments #457) and the intermittent exact 30-day analytics boundary ([BUG]: Flaky 30-day boundary test in analytics.healthMetrics.test.js due to Date.now() millisecond drift #403 / test(analytics): freeze system time to fix flaky 30-day boundary test #407). The unchanged analytics suite passed all 26 tests on an isolated recheck.git diff --checkpasses.Checklist
AI assistance
OpenAI GPT-6 in Codex assisted with implementation, regression tests, code review and local validation.
Summary by CodeRabbit