feat: Enable horizontal scrolling on search results table#1871
feat: Enable horizontal scrolling on search results table#1871elizabetdev wants to merge 8 commits intomainfrom
Conversation
…SearchPage and RawLogTable
- Added `miw={0}` to Flex components in DBSearchPage to ensure minimum width is set.
- Adjusted className in RawLogTable to remove redundant styles and improve readability.
- Enhanced LogTable styles with overflow and height properties for better layout on small screens.
… improved layout consistency
🦋 Changeset detectedLatest commit: 6fda610 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review: feat: Enable horizontal scrolling on search results table
✅ Everything else looks good — the |
There was a problem hiding this comment.
Stale comment
Code Review
The approach is sound — moving
overflow: auto/height: 100%to the SCSS module and addingmiw={0}to the flex containers is the correct way to enable horizontal scrolling in this component hierarchy.One issue worth addressing before merge:
⚠️ min-width: 1000pxon.tableis hardcoded and doesn't reflect actual column widths — The PR description says the table "calculates its minimum width by summing all fixed-width column sizes", but the implementation just uses a static1000px. Withtable-layout: fixed, the real column widths are controlled by TanStack'sgetSize()calls. This means: (a) with few narrow columns, a horizontal scrollbar appears unnecessarily; (b) with many wide columns totaling >1000px, the table can still overflow without triggering a scrollbar because themin-widthis already exceeded. The fix is to compute the total column width inRawLogTableand pass it as an inlinestyle={{ minWidth }}on the<table>element (or via a CSS custom property on the wrapper), removing the hardcoded value from the SCSS.Everything else looks good — the SCSS consolidation is clean, the
miw={0}Mantine prop usage is idiomatic, and removing the now-redundanteslint-disable-next-linecomments is correct since@typescript-eslint/no-explicit-anyis already'off'in the ESLint config.
There was a problem hiding this comment.
Stale comment
Code Review
The approach is correct (overflow on the wrapper + min-width on the table +
miw={0}flex fix), and the utility-class-to-SCSS migration and eslint-disable cleanup are clean. One issue worth addressing before merge:
⚠️ Hardcodedmin-width: 1000pxdoesn't match actual column state — The PR description says "calculates minimum width by summing all fixed-width column sizes," but the implementation just uses a static1000px. With only 1–2 narrow columns selected the table is unnecessarily wide (dead space); with many wide columns1000pxmay still be too small to prevent clipping. The actual column widths are already available via TanStack Table'stable.getTotalSize()— compute the min-width dynamically inRawLogTableand apply it as an inline style on the table element instead.✅ No other critical issues found.
…lculation - Implemented a dynamic minimum width calculation for the RawLogTable to enable horizontal scrolling on smaller viewports. - Updated table styles to ensure proper width handling and prevent the last column from collapsing. - Adjusted SCSS to enforce a 100% width for the table layout, ensuring consistent rendering across different screen sizes.
There was a problem hiding this comment.
Stale comment
Code Review
Overall the approach is sound —
miw={0}on the flex containers, computing a pixelminWidthfor the table, and consolidating utility classes into the SCSS module are all correct patterns.Two items worth addressing:
⚠️ useMemowith[table]won't memoize —useReactTablereturns a new object reference on every render, souseMemo(() => ..., [table])recomputes every render providing zero caching benefit. Either remove theuseMemowrapper, or derive the dependency from the actual column-sizing state (e.g.table.getState().columnSizing).
⚠️ width: 100% !importantin SCSS — No inlinewidthstyle is set on the<table>element (onlyminWidth), so there's nothing for a normalwidth: 100%declaration to lose a specificity battle against. The comment is vague about what "overrides" it.!importantcan silently mask future specificity conflicts; worth verifying this is truly necessary and tightening the comment if so.✅ All other changes look correct —
miw={0}is the right flex fix, thetableMinWidthcalculation logic handles theUNDEFINED_WIDTHsentinel correctly, and removing the now-redundanteslint-disablecomments is fine sinceno-explicit-anyis globallyoffin the project's ESLint config.
- Enhanced the minimum width calculation for the RawLogTable to accommodate dynamic column sizes and improve responsiveness. - Updated the table's SCSS to maintain a consistent 100% width without the need for `!important`, ensuring better layout handling across various screen sizes.
There was a problem hiding this comment.
Stale comment
✅ No critical issues found.
The implementation is clean and the approach is sound. A few minor observations for awareness:
- The
tableMinWidthuseMemomanually mirrors column default widths (170,115,160,32) that are already defined elsewhere in the same file. These are consistent today, but extracting them as shared constants would prevent future drift if defaults change.- The PR description mentions
width: 100% !importantbut the actual SCSS useswidth: 100%(no!important). This is fine functionally — removing the!importantfrom the oldw-100Bootstrap class is appropriate — but the description is slightly misleading.fs-8→var(--mantine-font-size-xs)migration is correct; the project's_utilities.scssconfirms these are equivalent.
There was a problem hiding this comment.
Stale comment
Code Review
The horizontal scrolling implementation is solid overall. One functional bug and one maintainability concern:
⚠️ Last-column resize ignored intableMinWidth— When a user has resized the last column (stored incolumnSizeStorage), thetableMinWidthuseMemo always substitutesMIN_FLEX_COLUMN_WIDTH = 200for it, ignoring the stored size. If the user resized the last column to e.g. 500px, the computed min-width would be ~300px short of the actual rendered table width, so the horizontal scrollbar may never appear. Fix: checkcolumnSizeStorage[displayedColumns[displayedColumns.length - 1]]and fall back toMIN_FLEX_COLUMN_WIDTHonly if absent.
⚠️ Duplicated default column widths — The fallback widths170/115/160intableMinWidthexactly mirror the defaults already in the column definitions (line 581). If a future change updates those defaults in one place but not the other, the min-width calculation silently diverges from actual rendered widths. Consider extracting shared constants (e.g.DEFAULT_DATE_COL_WIDTH,DEFAULT_SEVERITY_COL_WIDTH,DEFAULT_COL_WIDTH) used in both locations.✅ Everything else looks good — the Bootstrap utility class consolidation into the SCSS module is clean, the
miw={0}flex fixes are correct, and theoverflow: auto/height: 100%migration is functionally equivalent.
| expandWidth + | ||
| displayedColumns.reduce((total, column, i) => { | ||
| if (i === displayedColumns.length - 1) | ||
| return total + MIN_FLEX_COLUMN_WIDTH; |
There was a problem hiding this comment.
The last column's stored resize value in columnSizeStorage is not checked here — it always uses MIN_FLEX_COLUMN_WIDTH = 200. If the user has resized the last column to a larger value, tableMinWidth will undercount, and the horizontal scrollbar may not appear.
Suggested fix:
const lastCol = displayedColumns[displayedColumns.length - 1];
const lastColSize = columnSizeStorage[lastCol] ?? MIN_FLEX_COLUMN_WIDTH;
return total + lastColSize;There was a problem hiding this comment.
Code Review
✅ No critical bugs or security issues. The approach is sound and the changes are well-scoped.
One thing worth fixing:
⚠️ Duplicated column-size fallback logic —tableMinWidth(lines 698–699 inDBRowTable.tsx) re-implements the exact same defaults (isDate ? 170 : isMaybeSeverityText ? 115 : 160) already defined in the column definition (line 581). If those defaults ever change in one place, the other won't stay in sync. Consider using TanStack Table's own API after table initialization — e.g.table.getAllColumns().reduce(...)withcol.getSize()— or extracting the defaults into a shared constant/helper so there's a single source of truth.
Everything else (SCSS consolidation, miw={0} on flex containers, removing the now-redundant eslint-disable comments) looks correct and follows project patterns.
| const isDate = jsColumnType === JSDataType.Date; | ||
| const isMaybeSeverityText = column === logLevelColumn; | ||
| const size = | ||
| columnSizeStorage[column] ?? |
There was a problem hiding this comment.
This fallback logic (isDate ? 170 : isMaybeSeverityText ? 115 : 160) is identical to the column definition at line 581. Extract into a shared constant or helper (or use table.getAllColumns() + col.getSize()) to avoid the two falling out of sync.
|
May be an edge case, but if a column is moved over to the right and horizontal scrolling is enabled, I can never see the column even if I scroll. See video. Search---ClickStack.mp4 |


Summary
Closes HDX-2701
Enables horizontal scrolling on the search results table so that column content is no longer clipped when the viewport is narrower than the total column widths.
Changes
minWidthon the table element — Computes the sum of all column widths from TanStack Table'sgetSize()(substituting a 200px minimum for the flexible last column) and sets it as an inlinemin-widthon the<table>. When the container is narrower than this threshold, the table overflows and the wrapper scrolls horizontally. When wider,width: 100%ensures the table fills the container normally.min-width: 0on flex containers — Addedmiw={0}to theRawLogTableouter<Flex>and theDBSearchPageresults/pattern containers so flex children can shrink below their content size, allowing overflow to trigger scrolling.overflow: auto,height: 100%, andfont-sizefrom inline Bootstrap utility classes (overflow-auto,h-100,fs-8) into.tableWrapper, and movedwidth: 100% !importantinto.table(replacing thew-100class).Files changed
packages/app/src/components/DBRowTable.tsx— AddedtableMinWidthcomputation; set inlineminWidthon table; addedmiw={0}to outer Flex; moved utility classes to SCSSpackages/app/src/DBSearchPage.tsx— Addedmiw={0}to results and pattern container Flex wrapperspackages/app/styles/LogTable.module.scss— Addedoverflow,height,font-sizeto.tableWrapper; addedwidth: 100% !importantto.tableTest plan