Set document titles from current page content#1848
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR centralizes browser title construction with a new ChangesDocument Title Generation
sequenceDiagram
participant Page as Page Component
participant Router as useLocation()
participant TitleUtil as pageTitles
participant PageHeading
Page->>Router: read current pathname
Page->>TitleUtil: compute title using pathname, clusterName, entityName
TitleUtil->>Page: return computed documentTitle
Page->>PageHeading: render ResourcePageHeading with documentTitle
PageHeading->>document: set document.title (useEffect)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/components/common/PageHeading/__tests__/PageHeading.spec.tsx`:
- Around line 6-8: The test cleanup currently hard-resets document.title to an
empty string in the afterEach block; instead capture the original title before
tests run (e.g., store document.title in a variable at the top of
PageHeading.spec.tsx or in a beforeEach) and restore that saved value in the
afterEach handler so global state is returned to its prior value; update the
afterEach in PageHeading.spec.tsx to use the saved originalTitle rather than ''
and ensure the variable is accessible to the afterEach scope.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ebb7a07f-2818-4353-b38f-0801dd498950
📒 Files selected for processing (9)
frontend/src/components/Connect/Details/DetailsPage.tsxfrontend/src/components/Connect/Header/Header.tsxfrontend/src/components/ConsumerGroups/Details/ResetOffsets/ResetOffsets.tsxfrontend/src/components/KsqlDb/KsqlDb.tsxfrontend/src/components/Topics/Topic/Topic.tsxfrontend/src/components/common/PageHeading/PageHeading.tsxfrontend/src/components/common/PageHeading/__tests__/PageHeading.spec.tsxfrontend/src/lib/__test__/pageTitles.spec.tsfrontend/src/lib/pageTitles.ts
Resolves #324
Summary
Testing
Summary by CodeRabbit
New Features
Tests