Fixes #39340 - PageLayout accept JSX to title prop#10992
Open
andreilakatos wants to merge 1 commit into
Open
Conversation
Member
|
This seems to work similarly to I think we should think how to unite them a bit better so we dont fix issues in only one of our templates |
241f797 to
cd90e4c
Compare
cd90e4c to
2f67677
Compare
2f67677 to
f79816b
Compare
fd7afdc to
eaeba28
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors PageLayout to better support non-primitive headings and expands regression coverage, while also reusing PageLayout inside TableIndexPage to reduce duplicated page-structure code.
Changes:
- Updated
PageLayoutto introducecustomHeader,customToolbar, wrapper/className customization, and safer<title>handling. - Expanded
PageLayouttests to cover breadcrumbs viabreadcrumbOptions, custom header rendering, and additional layout slots. - Refactored
TableIndexPageto render viaPageLayout(moving title/breadcrumb/toolbar structure responsibility intoPageLayout).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| webpack/assets/javascripts/react_app/routes/common/PageLayout/PageLayout.js | Adds new layout customization props and adjusts title/header rendering logic. |
| webpack/assets/javascripts/react_app/routes/common/PageLayout/PageLayout.test.js | Adds test coverage for new PageLayout behaviors and slots. |
| webpack/assets/javascripts/react_app/routes/Audits/AuditsPage/tests/snapshots/AuditsPage.test.js.snap | Updates snapshots to reflect new PageLayout props/defaults. |
| webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/TableIndexPage.js | Replaces bespoke page chrome with PageLayout usage and a custom toolbar. |
Comments suppressed due to low confidence (2)
webpack/assets/javascripts/react_app/routes/common/PageLayout/PageLayout.js:76
- The
<title>is now forced to''wheneverheaderis not a string/number (or when onlycustomHeaderis provided), which can silently clear the browser tab title. The PR description mentions falling back to an explicitdocumentTitle—that prop isn’t implemented here, so consider adding it and using it as the<title>source whenheaderis a React node.
<Head>
<title>{titleForHead}</title>
</Head>
webpack/assets/javascripts/react_app/routes/common/PageLayout/PageLayout.js:205
headeris typed asPropTypes.string, but the implementation explicitly supports numbers (typeof header === 'number') and the PR intent is to allow JSX/ReactNode headings. Update the prop type to reflect the supported inputs (e.g., string/number/node) to avoid misleading warnings and to document the intended API.
toolbarButtons: PropTypes.node,
customToolbar: PropTypes.node,
header: PropTypes.string,
customHeader: PropTypes.node,
headerTitleOuiaId: PropTypes.string,
alwaysShowStandaloneTitleSection: PropTypes.bool,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MariaAga
reviewed
May 21, 2026
d0e5e9c to
0311bb4
Compare
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
Improves PageLayout reliability and regression coverage:
header(PropTypes.stringmust not be invoked), which prevented the test file from importing the component.<title>/ react-helmet safe whenheaderis not a primitive: document title uses optionaldocumentTitle, otherwise the string or number form ofheader; avoids passing a React tree into<title>.PageLayouttests forbreadcrumbOptions,beforeToolbarComponent, andheaderas a React component (composite heading inside the PFh1).Prerequisites for testing
enginesinpackage.jsonnpm installas usual)No extra Foreman infra (proxies, compute, DB fixtures beyond normal dev).
Test plan
npm test -- --testPathPattern=PageLayout.test.jsPageLayoutwith stringheader— heading and browser title unchanged from before.If anything uses
headeras a React node, optionally verifydocumentTitlesets the intended tab/window title when needed.