Conversation
Reviewer's GuideRefactors table column width/metadata handling to centralize header and width calculations, adds automatic width computation for previously zero-width visible columns on reset, and updates the sample Table usage accordingly. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- There is a stray
console.log(table, options);inresetColumnsthat should be removed or guarded behind a debug flag before merging. - In
setColSize, consider reusing the existing helper functions (getColumnHeader,getColumnName,getColumnMaxCellWidth) instead of directly querying attributes and DOM again, to keep the column access patterns consistent and reduce duplication. setColSizeassumesoptions.columnStatesis always defined and thatcol.widthis explicitlynull; defensive checks and possibly treatingundefinedthe same asnullwould make this more robust to missing or partially populated state.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There is a stray `console.log(table, options);` in `resetColumns` that should be removed or guarded behind a debug flag before merging.
- In `setColSize`, consider reusing the existing helper functions (`getColumnHeader`, `getColumnName`, `getColumnMaxCellWidth`) instead of directly querying attributes and DOM again, to keep the column access patterns consistent and reduce duplication.
- `setColSize` assumes `options.columnStates` is always defined and that `col.width` is explicitly `null`; defensive checks and possibly treating `undefined` the same as `null` would make this more robust to missing or partially populated state.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8055 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 766 766
Lines 34157 34155 -2
Branches 4697 4697
=========================================
- Hits 34157 34155 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses table column width persistence and auto-sizing when toggling column visibility causes overflow scenarios that can result in zero-width columns (fixes #8054). It refactors client-side column width/name lookup to rely on header metadata and adds logic to compute a fallback width from header + cell content when needed.
Changes:
- Move
data-bb-fieldto the header<th>and update resizing/tooltip/state code to resolve column name/width via the header. - Refactor column auto-fit sizing to reuse helpers for max cell width and header/cell measurement.
- Add a
setColSizepass duringresetColumnsto auto-calculate widths for visible columns that havenullstored widths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/BootstrapBlazor/Components/Table/Table.razor.js | Refactors resize/tooltip/state helpers and adds auto-sizing for null column widths during column reset. |
| src/BootstrapBlazor/Components/Table/Table.razor | Moves data-bb-field to <th> and removes it from the resizer element to support the new JS lookup approach. |
| src/BootstrapBlazor.Server/Components/Samples/Table/TablesColumnList.razor | Updates the sample to demonstrate fixed header + resizing/dragging and to better exercise column visibility toggling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Link issues
fixes #8054
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Improve table column auto-sizing and state handling for resizable, draggable columns with overflow.
New Features:
Bug Fixes:
Enhancements: