Skip to content

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Aug 29, 2025

Copy link

vercel bot commented Aug 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
table Ready Ready Preview Comment Aug 29, 2025 7:26am

Copy link

coderabbitai bot commented Aug 29, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbit review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/sticky-table-header

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.74%. Comparing base (8fd0790) to head (434ccd6).
⚠️ Report is 3 commits behind head on antd-5.x.

Additional details and impacted files
@@             Coverage Diff              @@
##           antd-5.x    #1323      +/-   ##
============================================
- Coverage     97.74%   97.74%   -0.01%     
============================================
  Files            77       77              
  Lines          7625     7623       -2     
  Branches       1155     1154       -1     
============================================
- Hits           7453     7451       -2     
  Misses          166      166              
  Partials          6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@afc163 afc163 requested a review from Copilot August 29, 2025 07:24
@afc163 afc163 marked this pull request as ready for review August 29, 2025 07:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue with sticky header column widths when the table has empty data. The fix ensures that column widths are properly maintained in sticky headers when there's no data by using the original column group instead of calculated widths.

Key changes:

  • Modified FixedHolder to conditionally use original colGroup for empty data scenarios
  • Removed maxContentScroll property handling that was causing width calculation issues
  • Added test cases to verify the fix for various empty data scenarios

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/FixedHolder/index.tsx Updates column width logic to use original colGroup when no data is present
src/Table.tsx Passes bodyColGroup to FixedHolder components and removes maxContentScroll prop
docs/examples/stickyHeader.tsx Adds test cases for sticky headers with empty data scenarios
tests/__snapshots__/FixedColumn.spec.tsx.snap Updates test snapshots to reflect new column width behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@afc163 afc163 merged commit 1b75be2 into antd-5.x Aug 29, 2025
10 checks passed
@afc163 afc163 deleted the fix/sticky-table-header branch August 29, 2025 07:29
>
{(!noData || !maxContentScroll || allFlattenColumnsWithWidth) && (
{/* use original ColGroup if no data, otherwise use calculated column width */}
{noData ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果只有 noData 会不会不够,虽然没数据列头不换行了,那还有个场景(列的数据比列头少,也会换行吧?)

我目前的解法是,取 title 的元素,在第一行里 height =0 再渲染一次,撑起宽度

];

const columnsWithWidth: ColumnType<RecordType>[] = [
{ title: 'title1', dataIndex: 'a', key: 'a', width: 100 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用了 max-content,这里不应该再加 width 的,这样会忽略掉问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants