Repository navigation
fix(results): fit result grid columns to header content (#1101) - #1113
Conversation
aea0e92 to
5ecf813
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
cevheri
left a comment
There was a problem hiding this comment.
Thanks Igor, this works well. I ran a 13 column query in the browser from 768 to 2560px wide: main cut off 11 headers, this branch 2. Phone layouts are unchanged, and the double-click reset works with a real mouse.
Four small things, then this is ready:
- The double-click test still passes with
table.resetColumnSizing()in place ofheader.column.resetSize(). Please drag both columns, double-clickname, and assert thatemailkeeps its dragged width. - No component case sets
columnTypesor masking, so dropping those two arguments from the size call goes unnoticed. One case with a declared type and a masked column would cover it. - Past the 500px cap a name can never be read in full, because dragging stops at 500 too, and SQL Server allows 128 character names. Please add
title={field}to the header's name span, as the type label next to it already has, and assert it. - Please extend the Column Management bullet in
docs/FEATURES.md: a column opens at a width that fits its header, and a double-click on the resize handle restores it. One sentence per line.
|
Addressed the review feedback in commit |
|
Thanks, all four are in, and each new test fails when I break the code it covers. One small thing left: rewriting "renders headers unchanged when the result declares no types at all" dropped its guard. With |
|
Ah, I hadn't caught that. I tested this, but missed that the previous no-types tooltip guard had been weakened. Thanks for pointing it out. I restored the guard while excluding field-name titles, and verified it fails with |
…dths in libredb#1113 The header-fit width is right for Latin names at the default font size. Two cases it does not cover were measured in the browser during the review and are not regressions of this change, so they are filed rather than asked of the contributor: wide characters (U48) and a larger root font size (U49).
|
yhanks Igor, great work, and quick turnarounds on every round, I will merge this shortly |
Description
The Results Grid used one fixed initial width for every result column, so headers could be compressed or appear uniformly sized. This change sizes each desktop result column from the visible header content while leaving cell rendering and user resizing behavior unchanged.
Type of Change
Related Issue
Closes #1101
Changes Made
docs/FEATURES.md.Testing
Test Environment
Checks run
bun tests/run-tests.ts tests/unit/components/results-grid-column-sizing.test.ts tests/components/ResultsGrid.test.tsx— 106/106 passedbunx tsc --noEmit --pretty false— passedbunx biome checkon changed code files — passedbun run lint— 0 errors; existing warnings remainbun run build— passedSELECT * FROM employeeagainst Sample (Employees); all six headers rendered without truncation and with distinct widths.The full
bun run testcommand was also attempted. It currently reports unrelated/environment-sensitive failures in 16 files under the local Bun 1.3.14 environment; neither changed ResultsGrid test file failed.Screenshots (if applicable)
Browser validation was performed with the built-in Employees sample. No screenshot is attached because the behavior is covered by the automated DOM assertions and the live UAT.
Checklist
src/lib/db/providers/, I updated the matching provider documentation and tests (n/a)Additional Notes
The live browser check used
SELECT * FROM employeeas requested. The implementation does not size columns from cell values.#1101is the source issue and is closed by this PR.