Skip to content

Conversation

crazyair
Copy link
Contributor

@crazyair crazyair commented Sep 4, 2025

1b75be2...antd-5.x

Summary by CodeRabbit

  • 新功能

    • 固定表头/列支持自定义 tableLayout 与滚动区域样式(可配置表格布局与滚动样式)。
    • 宽度测量改进:测量单元格会使用列标题参与宽度计算,提升分组与空数据场景下列宽精度。
  • 文档

    • 新增“空数据的粘性表头”示例,展示固定列、显式列宽与分组表头用法并优化示例布局(移除多余固定高度)。
  • 杂务

    • 包版本更新至 1.5.3;新增 .npmrc 配置。

zombieJ and others added 29 commits February 14, 2025 15:36
* fix: sticky event loop

* chore: adjust script
* fix: scroll logic (react-component#1239)

* fix: scroll logic

* fix: ci

* chore: fix lint
* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: test

* feat: 迁移

* feat: 同步
…eact-component#1318)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…1323)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lculation (react-component#1331)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…act-component#1332)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…ent#1333)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

vercel bot commented Sep 4, 2025

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

Project Deployment Preview Comments Updated (UTC)
table Ready Ready Preview Comment Sep 4, 2025 5:23am

Copy link

coderabbitai bot commented Sep 4, 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.

Walkthrough

此变更将列定义传入测量链路(MeasureRow → MeasureCell),调整测量单元格渲染与样式;在 FixedHolder 中新增 tableLayout 与 scrollTableStyle 配置并重构 ColGroup 渲染以支持动态列宽;示例 docs 扩展粘性表头空数据用例;版本升至 1.5.3。

Changes

Cohort / File(s) Summary
Docs 示例:Sticky Header 扩展
docs/examples/stickyHeader.tsx
引入 ColumnsType,新增 columnsWithWidthcolumnsGrouped,移除示例容器高度并新增“Sticky header with empty data”多场景表格渲染(空数据/分组列/固定列等)。
测量链路:传入完整列定义
src/Body/MeasureCell.tsx, src/Body/MeasureRow.tsx, src/Body/index.tsx
MeasureCell 新增可选 column?: ColumnType<any> 并在隐藏测量节点渲染 column.title;MeasureRow 接收并使用 columns: readonly ColumnType<any>[],按 key 查找 column 并传入 MeasureCell;Body 传入 flattenColumns
FixedHolder:表布局与 ColGroup 重构
src/FixedHolder/index.tsx, src/Table.tsx
新增 scrollTableStyle?: React.CSSPropertiestableLayout?: TableLayout props(默认 'fixed');将 tableLayout 与 scrollTableStyle 传递给 TableComponent;以 memo 化 colGroupNode 在有无计算列宽间选择 ColGroup。
类型增强
src/ColGroup.tsx
为局部变量 additionalProps 添加显式类型 Record<string, unknown>,无行为变更。
版本与配置
package.json, .npmrc
package.json 版本从 1.5.2 升至 1.5.3;新增 .npmrc 包含 shamefully-hoist=true

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Table
  participant FH as FixedHolder
  participant TC as TableComponent
  participant CG as ColGroup

  App->>FH: render FixedHolder({ scrollTableStyle, tableLayout, ... })
  activate FH
  FH->>FH: compute mergedColumnWidth, combinationScrollBarSize
  alt 有数据且已计算列宽
    FH->>CG: build ColGroup(按合并列宽+滚动条宽)
  else 无数据或无列宽
    FH->>CG: build ColGroup(原始列定义)
  end
  FH->>TC: render table with { tableLayout, style: scrollTableStyle }
  TC-->>FH: table element
  FH-->>App: rendered fixed holder
  deactivate FH
Loading
sequenceDiagram
  autonumber
  participant Body as Body
  participant MR as MeasureRow
  participant MC as MeasureCell

  Body->>MR: render MeasureRow({ columnsKey, columns, onColumnResize })
  MR->>MR: for each key → find column by key
  MR->>MC: render MeasureCell({ columnKey, column, onColumnResize })
  MC->>MC: render hidden content: column.title || &nbsp;
  MC-->>MR: measured width
  MR-->>Body: report onColumnResize(key, width)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • zombieJ
  • afc163
  • MadCcc

Poem

我是小兔咬着尺,跳过表头又绕堆。
标题躲进隐藏行,静静量宽不费哆。
新版布局轻轻拍,粘性表头稳又乖。 🥕🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai 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 @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @crazyair, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on refining the sticky header functionality within the table component. It introduces new examples to cover various sticky header use cases, particularly with empty data and complex column structures. Additionally, it enhances the underlying column measurement logic and provides more granular control over table layout and styling, contributing to a more robust and flexible table component.

Highlights

  • Enhanced Sticky Header Examples: New examples added to stickyHeader.tsx demonstrating sticky headers with empty data, fixed widths, and grouped columns.
  • Improved Column Measurement: The MeasureCell and MeasureRow components now receive column data, allowing for more accurate column width calculations, especially for sticky headers.
  • Flexible Table Layout: Added scrollTableStyle and tableLayout props to FixedHolder and Table components, providing more control over table styling and layout.
  • Version Bump: The package version has been updated to 1.5.3.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several enhancements and fixes for the sticky header feature, particularly for tables with empty data or when using scroll.x: 'max-content'. It improves column width measurement by rendering column titles in a hidden row. While the changes are mostly good, I've found a critical bug in FixedHolder that could cause a runtime error, and a performance issue in MeasureRow that could affect tables with many columns. My review includes suggestions to fix these issues.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (11)
package.json (1)

5-7: engines 要求过低,建议与工具链对齐

当前 dev 依赖(如 husky@9、vitest@3、dumi@2)通常需要 Node ≥18。建议提升 engines 以避免本地/CI 使用低版本 Node 导致的不可预期问题。

可选调整示例:

   "engines": {
-    "node": ">=8.x"
+    "node": ">=18"
   },
docs/examples/stickyHeader.tsx (2)

89-115: columnsGrouped 中的 rowScope 属性需确认类型来源

代码里使用了 rowScope: 'row'。在 rc-table 的列类型里常见的是通过 onHeaderCell 传递 th 的 scope 属性。请确认现有类型是否显式支持 rowScope,否则建议改为 onHeaderCell

参考修改:

   {
-    title: '',
-    dataIndex: 'productType',
-    key: 'productType',
-    rowSpan: 2,
-    rowScope: 'row',
+    title: '',
+    dataIndex: 'productType',
+    key: 'productType',
+    rowSpan: 2,
+    onHeaderCell: () => ({ scope: 'row' }),
   },

247-318: “空数据”多用例演示:建议补充 rowKey 避免控制台警告

多处传入 data={[]}data={[{}]},默认 rowKey: 'key' 会在开发环境产生 “missing key” 警告。建议为示例加一个按索引生成的 rowKey,顺带可去重样板代码。

可最小改动如下:

@@
-const columnsGrouped: ColumnsType<any> = [
+const columnsGrouped: ColumnsType<any> = [
   /* ... */
 ];
+
+// 示例专用:空数据/无 key 的行避免警告
+const rowIndexKey = (_: unknown, i: number) => i;
@@
-      <Table
+      <Table
         columns={fixedColumns}
         data={[]}
         scroll={{
           x: 'max-content',
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={fixedColumns}
         data={[]}
         scroll={{
           x: 1200,
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={columnsWithWidth}
         data={[]}
         scroll={{
           x: 'max-content',
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={fixedColumns}
         data={[{}]}
         scroll={{
           x: 'max-content',
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={columnsWithWidth}
         data={[{}]}
         scroll={{
           x: 1200,
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={fixedColumns.map(column => ({ ...column, width: undefined }))}
         data={[]}
         scroll={{
           x: 'max-content',
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={fixedColumns.map(column => ({ ...column, width: undefined }))}
         data={[{}]}
         scroll={{
           x: 'max-content',
         }}
+        rowKey={rowIndexKey}
         sticky
       />
@@
-      <Table
+      <Table
         columns={columnsGrouped}
         data={[{}, {}]}
         scroll={{
           x: 'max-content',
         }}
+        rowKey={rowIndexKey}
         sticky
       />

另外,这一组 Table 块存在较多重复 props,可考虑提炼一个小渲染函数以减少重复。

src/Table.tsx (1)

816-817: CSS 类名使用 tableLayout 而非 mergedTableLayout:可能与真实布局不一致

当未显式传入 tableLayout、但计算得到 mergedTableLayout='fixed' 时,类名 ${prefixCls}-layout-fixed 不会生效。建议使用合并后的布局值。

修正示例:

-        [`${prefixCls}-layout-fixed`]: tableLayout === 'fixed',
+        [`${prefixCls}-layout-fixed`]: mergedTableLayout === 'fixed',
src/Body/MeasureCell.tsx (2)

9-12: 将 ColumnType 泛型透传,避免 any 侵入。

当前 column?: ColumnType<any> 会丢失记录类型信息。建议为组件与 props 增加可推断的泛型,以保持端到端的类型安全。

-export interface MeasureCellProps {
+export interface MeasureCellProps<RecordType = unknown> {
   columnKey: React.Key;
   onColumnResize: (key: React.Key, width: number) => void;
-  column?: ColumnType<any>;
+  column?: ColumnType<RecordType>;
 }
 
-export default function MeasureCell({ columnKey, onColumnResize, column }: MeasureCellProps) {
+export default function MeasureCell<RecordType = unknown>({
+  columnKey,
+  onColumnResize,
+  column,
+}: MeasureCellProps<RecordType>) {

23-29: 测量节点样式建议加固:禁用换行避免测量抖动。

若表头样式是单行展示,建议在隐藏测量容器上加 whiteSpace: 'nowrap',以避免换行导致的宽度偏差;同时保持加粗有助于更贴近真实渲染。

-        <div style={{ height: 0, overflow: 'hidden', fontWeight: 'bold' }}>
+        <div style={{ height: 0, overflow: 'hidden', fontWeight: 'bold', whiteSpace: 'nowrap' }}>
           {column?.title || '\xa0'}
         </div>
src/FixedHolder/index.tsx (1)

199-205: 样式合并顺序请确认意图。

当前将 ...scrollTableStyle 置于最后,允许外部覆写 tableLayoutvisibility。若不期望外部覆盖可见性(例如无宽度时强制隐藏),建议调整合并顺序或白名单式透传。

可选调整(若希望内部优先生效):

-        style={{
-          tableLayout,
-          visibility: noData || mergedColumnWidth ? null : 'hidden',
-          ...scrollTableStyle,
-        }}
+        style={{
+          ...(scrollTableStyle || {}),
+          tableLayout,
+          visibility: noData || mergedColumnWidth ? undefined : 'hidden',
+        }}
src/Body/MeasureRow.tsx (4)

7-12: 为 MeasureRow 引入泛型,避免 any

columns: readonly ColumnType<any>[] 改为可推断的泛型,保证列定义类型一致性。

-export interface MeasureRowProps {
+export interface MeasureRowProps<RecordType = unknown> {
   prefixCls: string;
   onColumnResize: (key: React.Key, width: number) => void;
   columnsKey: React.Key[];
-  columns: readonly ColumnType<any>[];
+  columns: readonly ColumnType<RecordType>[];
 }

14-19: 提前构建 key→column 映射,避免 O(n²) 查找。

在列数较多时,逐项 find 会退化为 O(n²)。预先用 useMemo 构建 Map,渲染阶段 O(1) 读取。

-export default function MeasureRow({
-  prefixCls,
-  columnsKey,
-  onColumnResize,
-  columns,
-}: MeasureRowProps) {
+export default function MeasureRow<RecordType = unknown>({
+  prefixCls,
+  columnsKey,
+  onColumnResize,
+  columns,
+}: MeasureRowProps<RecordType>) {
   const ref = React.useRef<HTMLTableRowElement>(null);
+  const columnMap = React.useMemo(() => {
+    const m = new Map<React.Key, ColumnType<RecordType>>();
+    columns.forEach(col => m.set(col.key, col));
+    return m;
+  }, [columns]);

23-23: 移除 fontSize: 0 可能影响极端场景下行高。

历史上在部分浏览器(尤其是旧版 Safari/Firefox)中,表格隐藏测量行若没有 fontSize: 0,可能出现极细微的高度撑开。建议保留以稳妥。

-    <tr aria-hidden="true" className={`${prefixCls}-measure-row`} style={{ height: 0 }} ref={ref}>
+    <tr aria-hidden="true" className={`${prefixCls}-measure-row`} style={{ height: 0, fontSize: 0 }} ref={ref}>

33-43: 用 Map 读取列定义,避免重复线性查找。

find 替换为 columnMap.get,性能与可读性更好。

-        {columnsKey.map(columnKey => {
-          const column = columns.find(col => col.key === columnKey);
+        {columnsKey.map(columnKey => {
+          const column = columnMap.get(columnKey);
           return (
             <MeasureCell
               key={columnKey}
               columnKey={columnKey}
               onColumnResize={onColumnResize}
               column={column}
             />
           );
         })}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5d0f833 and 54f9f28.

📒 Files selected for processing (8)
  • docs/examples/stickyHeader.tsx (4 hunks)
  • package.json (1 hunks)
  • src/Body/MeasureCell.tsx (2 hunks)
  • src/Body/MeasureRow.tsx (2 hunks)
  • src/Body/index.tsx (1 hunks)
  • src/ColGroup.tsx (1 hunks)
  • src/FixedHolder/index.tsx (5 hunks)
  • src/Table.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-08T12:53:09.293Z
Learnt from: bbb169
PR: react-component/table#1202
File: src/Table.tsx:903-904
Timestamp: 2024-11-08T12:53:09.293Z
Learning: 在 `src/Table.tsx` 文件的 React 组件 `Table` 中,即使 `bodyScrollLeft` 频繁更新,也需要在 `TableContextValue` 的 `useMemo` 依赖数组中包含 `bodyScrollLeft` 和 `headerCellRefs`,因为每次滚动时重新计算 `TableContextValue` 是解决该问题所必须的。

Applied to files:

  • docs/examples/stickyHeader.tsx
  • src/Table.tsx
  • src/FixedHolder/index.tsx
🧬 Code graph analysis (3)
docs/examples/stickyHeader.tsx (1)
src/interface.ts (2)
  • ColumnType (118-133)
  • ColumnsType (135-138)
src/FixedHolder/index.tsx (1)
src/interface.ts (1)
  • TableLayout (30-30)
src/Body/MeasureRow.tsx (2)
src/interface.ts (1)
  • Key (21-21)
src/Body/MeasureCell.tsx (1)
  • MeasureCell (12-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test / react component workflow
🔇 Additional comments (11)
package.json (1)

3-3: 版本号提升到 1.5.3:就绪发布

与本 PR 的 API/样式增强相匹配,变更合理。

发布前请确认:

  • 已在 CHANGELOG/Release Notes 标注 “FixedHolder: 新增 scrollTableStyle/tableLayout;测量链路传递 column”等。
  • 打上 v1.5.3 git tag,并确认 npm 上的 dist 文件已包含本次变化。
docs/examples/stickyHeader.tsx (3)

5-5: 类型导入扩展:与接口定义一致

新增 ColumnsType 的按需 type 导入正确,能覆盖分组列用例。


82-87: 新增 columnsWithWidth:示例完备

为空数据/固定宽度场景提供了更清晰的演示。建议保持各列 key 唯一且稳定(当前 OK)。


143-143: 容器高度限制移除:更贴近真实滚动

将外层固定高度容器移除有助于验证 sticky 在多种布局下的行为,变更合理。

src/Body/index.tsx (1)

149-150: 将完整列定义传入 MeasureRow:与测量链路改造对齐

传入 columns={flattenColumns} 使 MeasureCell 能使用 column.title 进行隐藏测量,变更正确。

src/Table.tsx (1)

723-724: 向 FixedHolder 传递 scrollTableStyle 与 tableLayout:铺平固定区域布局一致性

与 FixedHolder 的新增 props 对齐,有助于头/尾/体三处表格在固定布局下保持一致宽度与布局策略。

请确认:

  • FixedHolderProps 已包含 scrollTableStyle?: React.CSSPropertiestableLayout?: TableLayout,并在内部透传至 TableComponent
  • 两条渲染路径(fixHeader/isSticky 与非固定)对 tableLayout 的使用保持一致(当前看已在两处都用 mergedTableLayout)。
src/Body/MeasureCell.tsx (1)

4-4: 类型导入对齐接口,OK。

../interface 的类型收敛良好,无需改动。

src/FixedHolder/index.tsx (3)

10-10: 类型导入扩展合理。

引入 TableLayout 与现有接口保持一致,为后续样式控制提供类型约束。


39-41: API 扩展 LGTM。

新增 scrollTableStyle?tableLayout?(默认 'fixed')与现有行为兼容,向后不破坏。


64-66: 默认值设计合理。

tableLayout = 'fixed' 保持历史默认渲染语义,scrollTableStyle 外部可覆写细节样式。

src/Body/MeasureRow.tsx (1)

5-5: 类型导入 OK。

MeasureCell 的新签名对齐。

Copy link

codecov bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.11%. Comparing base (5d0f833) to head (b0a7ff0).
⚠️ Report is 31 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1336      +/-   ##
==========================================
+ Coverage   96.07%   96.11%   +0.03%     
==========================================
  Files          57       57              
  Lines        3417     3448      +31     
  Branches      622      628       +6     
==========================================
+ Hits         3283     3314      +31     
  Misses        129      129              
  Partials        5        5              

☔ 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 54f9f28 and b0a7ff0.

⛔ Files ignored due to path filters (3)
  • tests/__snapshots__/ExpandRow.spec.jsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/FixedColumn.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/Table.spec.jsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • .npmrc (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test / react component workflow

@@ -0,0 +1 @@
shamefully-hoist=true No newline at end of file
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

请确认团队确实使用 pnpm;shamefully-hoist 为 pnpm 专属配置。

若项目并未统一使用 pnpm,此项在 npm/yarn 下无效,且可能让新同学误解。若确需启用,建议补充注释或以更细粒度的 public-hoist-pattern 限定,以避免无差别提升带来的体积增大与掩盖 peerDependencies 问题。

可运行下列脚本核实仓库是否以 pnpm 为标准(检查 lockfile、packageManager 字段与 CI 使用情况):

如需仅保留说明,可采纳以下微调,以增加可维护性:

-shamefully-hoist=true
+# pnpm only: flatten node_modules for legacy deps; prefer public-hoist-pattern when possible.
+shamefully-hoist=true

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Lockfiles =="
fd -a -H 'pnpm-lock.yaml' || true
fd -a -H 'yarn.lock' || true
fd -a -H 'package-lock.json' || true

echo "== packageManager field =="
if [ -f package.json ]; then
  jq -r '.packageManager // "N/A"' package.json
else
  echo "package.json not found"
fi

echo "== CI references to pnpm/corepack =="
rg -nP -C2 '\bpnpm\b|\bcorepack\b' -g '.github/workflows/**' || true

Length of output: 579


确认并纠正 .npmrc 中的 pnpm 专属配置
当前仓库未检测到 pnpm-lock.yaml、packageManager 字段或 CI 工作流中的 pnpm 相关引用,说明并未使用 pnpm。

  • 若非 pnpm 项目,删除 shamefully-hoist=true
  • 若确需使用 pnpm 并保持此配置,请添加注释并优先采用 public-hoist-pattern 以限定依赖提升范围,避免体积膨胀和 peerDependencies 被隐藏。
🤖 Prompt for AI Agents
In .npmrc around line 1, the file currently contains a pnpm-specific setting
(shamefully-hoist=true) but the repo lacks pnpm indicators; if this is not a
pnpm project, remove that line from .npmrc; if you do intend to use pnpm and
keep this behavior, add a comment explaining why shamefully-hoist is required
and replace or accompany it with a public-hoist-pattern setting to limit which
packages are hoisted (thereby preventing bundle bloat and hiding
peerDependencies).

@afc163 afc163 changed the title Sync chore: sync antd-5.x to master Sep 4, 2025
@afc163 afc163 merged commit 253eb42 into react-component:master Sep 4, 2025
9 checks passed
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.

7 participants