Skip to content

Commit fda21df

Browse files
committed
fix(table-view): restore one-line truncation and pin the header
The read-only TableView carried `overflow-clip text-ellipsis` on its cell kinds but no `whitespace-nowrap` — which the grid gets from its own CELL_CONTENT. An ellipsis needs a single non-wrapping line, so those classes were inert: text wrapped to several lines and rows grew unevenly where the grid renders one line and an ellipsis. Adds the rule plus `min-w-0` so the flex container can shrink below the now-unwrapped content. Also pins the header, matching the grid, so a long table in a panel keeps its column labels while scrolling. Both are scoped to table-view.tsx; the grid's own rendering path is untouched.
1 parent 9fae741 commit fda21df

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

apps/sim/components/resources/table-view/table-view.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ export function TableView({ source }: TableViewProps) {
127127
<div className='flex h-full min-h-0 flex-col'>
128128
<div onScroll={handleScroll} className='min-h-0 flex-1 overflow-auto overscroll-contain'>
129129
<Table>
130-
<TableHeader>
130+
{/* Pinned so a long table keeps its column labels, as the grid does. */}
131+
<TableHeader className='sticky top-0 z-10 bg-[var(--bg)]'>
131132
<TableRow>
132133
{displayColumns.map((column) => (
133134
<TableHead key={column.key} className='whitespace-nowrap'>
@@ -155,8 +156,17 @@ export function TableView({ source }: TableViewProps) {
155156
* an all-empty row would collapse to its padding. The floor lives
156157
* on a wrapper rather than in `CellRender` so the grid is
157158
* unaffected.
159+
*
160+
* `whitespace-nowrap` is load-bearing, not decoration: the
161+
* cell kinds already carry `overflow-clip text-ellipsis`,
162+
* but an ellipsis needs a single non-wrapping line to
163+
* appear. Without it those classes are inert, text wraps to
164+
* several lines, and rows grow unevenly — where the grid
165+
* gets the same rule from its own `CELL_CONTENT`.
166+
* `min-w-0` lets the flex container shrink below that
167+
* now-unwrapped content instead of forcing the column wide.
158168
*/}
159-
<span className='flex min-h-[20px] items-center'>
169+
<span className='flex min-h-[20px] min-w-0 items-center overflow-clip whitespace-nowrap'>
160170
<CellContent
161171
value={row.data[getColumnId(column)]}
162172
column={column}

0 commit comments

Comments
 (0)