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
fix: keep className and style from onHeaderRow - #1521
className and style returned by onHeaderRow never reach the header <tr>. Other props such as id still do. antd passes onHeaderRow straight through (antd master pins ~1.11.1), so an antd Table whose onHeaderRow returns a className or style renders the header row without them.
The explicit props come after the spread, so they always replace the values from onHeaderRow, even when classNames.header.row and styles.header.row are not set. The bug is in every release from 1.3.0 to 1.12.0.
This change merges the two sources the same way BodyRow already does for onRow: the onHeaderRow value first, then the semantic one. className stays undefined when both are empty, so the existing snapshots do not change.
The pre-commit prettier hook also wrapped the long onHeaderCell line in the same file. #1516 makes the same change to that line, and a local git merge-tree against its head merges cleanly.
Tests
Two cases next to renders onHeaderRow correctly in tests/Table.spec.jsx:
onHeaderRow returns a className and a style, and both are on thead tr
the same together with classNames.header.row and styles.header.row, and all four values are on thead tr
Verification
Both new tests fail on master (no my-header-row class, empty style.color) and pass with this change
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 61f8537b-0831-4519-a63a-fe856f1b34d8
📥 Commits
Reviewing files that changed from the base of the PR and between e63fbf5 and 4b1098e.
📒 Files selected for processing: 2
src/Header/HeaderRow.tsx
tests/Table.spec.jsx
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
拉取请求标题为「fix: keep className and style from onHeaderRow」。标题清晰、简洁,直接描述了变更的主要内容:保留 onHeaderRow 返回的 className 和 style 属性。标题与代码变更相符,反映了在 HeaderRow 组件中实现的修复,即合并 onHeaderRow 回调返回的样式属性与语义样式值。
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint install failed due to a network error.
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 @coderabbitai help to get the list of available commands.
This branch has not been deployed
No deployments
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.
Summary
classNameandstylereturned byonHeaderRownever reach the header<tr>. Other props such asidstill do. antd passesonHeaderRowstraight through (antdmasterpins~1.11.1), so an antd Table whoseonHeaderRowreturns aclassNameorstylerenders the header row without them.Since #1261 (b10f4d4)
HeaderRowrenders:The explicit props come after the spread, so they always replace the values from
onHeaderRow, even whenclassNames.header.rowandstyles.header.roware not set. The bug is in every release from 1.3.0 to 1.12.0.This change merges the two sources the same way
BodyRowalready does foronRow: theonHeaderRowvalue first, then the semantic one.classNamestaysundefinedwhen both are empty, so the existing snapshots do not change.The pre-commit prettier hook also wrapped the long
onHeaderCellline in the same file. #1516 makes the same change to that line, and a localgit merge-treeagainst its head merges cleanly.Tests
Two cases next to
renders onHeaderRow correctlyintests/Table.spec.jsx:onHeaderRowreturns aclassNameand astyle, and both are onthead trclassNames.header.rowandstyles.header.row, and all four values are onthead trVerification
master(nomy-header-rowclass, emptystyle.color) and pass with this changenpm test: 21 files passed, 238 tests passed, no snapshot changesnpm run tscnpm run lint: 0 errors, the same 23 warnings as onmaster, none in the changed filesprettier --checkandgit diff --checkon the changed filesSummary by CodeRabbit