Repository navigation
fix(data-table): prevent component cell clipping - #5536
Conversation
- apply table-level truncation only to primitive text cells. - let tables expand to content width with horizontal scrolling to avoid column overlap. - update model badges to show full model names on one line.
WalkthroughThe data table is updated to use auto table layout with ChangesData Table Cell Overflow and Sizing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (2)
web/default/src/components/data-table/core/data-table-row.tsx (2)
104-118: 💤 Low valueConsider adding an explicit return type for better type safety and documentation.
The inferred return type of
renderCellContentis correct, but explicitly declaring it would improve code clarity and catch potential type mismatches earlier.📝 Proposed type declaration
+interface CellContentResult { + content: React.ReactNode + isPrimitive: boolean +} + -function renderCellContent<TData>(cell: Cell<TData, unknown>) { +function renderCellContent<TData>(cell: Cell<TData, unknown>): CellContentResult { const content = flexRender(cell.column.columnDef.cell, cell.getContext()) const textContent = getPrimitiveTextContent(content)🤖 Prompt for 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. In `@web/default/src/components/data-table/core/data-table-row.tsx` around lines 104 - 118, Add an explicit return type annotation to the renderCellContent function to improve type safety and documentation. The function currently relies on TypeScript's type inference for its return type. Declare the return type as an object with content property (which accepts React.ReactNode or similar) and isPrimitive property (boolean) to make the contract explicit and catch potential type mismatches earlier in development.
104-126: Add explicit return type annotation torenderCellContentfor clarity.The refactored function lacks an explicit return type annotation and relies on TypeScript type inference. While the code is type-safe and usage correctly destructures both properties (
isPrimitiveandcontent), explicitly annotating the return type aligns with TypeScript best practices and the project's coding guidelines on explicit type annotations.Define the return type:
Suggested type definition
type RenderCellResult = { content: React.ReactNode isPrimitive: boolean } function renderCellContent<TData>(cell: Cell<TData, unknown>): RenderCellResult { // existing implementation }🤖 Prompt for 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. In `@web/default/src/components/data-table/core/data-table-row.tsx` around lines 104 - 126, Add an explicit return type annotation to the `renderCellContent` function to align with TypeScript best practices. First, define a new type called RenderCellResult that represents the return object structure with two properties: content of type React.ReactNode and isPrimitive of type boolean. Then, annotate the `renderCellContent` function signature with the RenderCellResult return type. This clarifies the contract of the function and improves code readability without changing the implementation logic.
🤖 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.
Nitpick comments:
In `@web/default/src/components/data-table/core/data-table-row.tsx`:
- Around line 104-118: Add an explicit return type annotation to the
renderCellContent function to improve type safety and documentation. The
function currently relies on TypeScript's type inference for its return type.
Declare the return type as an object with content property (which accepts
React.ReactNode or similar) and isPrimitive property (boolean) to make the
contract explicit and catch potential type mismatches earlier in development.
- Around line 104-126: Add an explicit return type annotation to the
`renderCellContent` function to align with TypeScript best practices. First,
define a new type called RenderCellResult that represents the return object
structure with two properties: content of type React.ReactNode and isPrimitive
of type boolean. Then, annotate the `renderCellContent` function signature with
the RenderCellResult return type. This clarifies the contract of the function
and improves code readability without changing the implementation logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: caff4bd2-5f61-418d-9b47-40104997b0ec
📒 Files selected for processing (3)
web/default/src/components/data-table/core/data-table-row.tsxweb/default/src/components/data-table/core/table-sizing.tsweb/default/src/features/usage-logs/components/model-badge.tsx
Merge pull request QuantumNous#5536 from QuantumNous/fix/data-table-component-cells
Merge pull request QuantumNous#5536 from QuantumNous/fix/data-table-component-cells
Merge pull request QuantumNous#5536 from QuantumNous/fix/data-table-component-cells
Merge pull request QuantumNous#5536 from QuantumNous/fix/data-table-component-cells
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
修复表格中非纯文本组件内容被外层裁剪或溢出到相邻列的问题。表格层现在只对纯文本单元格应用省略和 tooltip 逻辑;组件型单元格由组件自身决定显示策略。同时调整表格宽度计算,使内容可撑开表格并通过横向滚动承载,避免长模型名称与后续列重叠。模型徽章现在完整单行显示模型名称。
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit