Skip to content

Commit 0bf4051

Browse files
authored
fix(replay): Pass undefiend to handleSortClick when sorting isnt defined (#95757)
This makes table headers divs instead of buttons when they don't support sorting. Sorting could be disabled at all times if a column hasn't defined `sortKey`, or it could be disabled for a whole table-instance if `onSortClick` isn't passed as a prop. **Before** Things looked clickable but weren't <img width="1112" height="69" alt="Screenshot 2025-07-16 at 9 33 38 PM" src="https://github.com/user-attachments/assets/d7fd0bc5-116a-433e-8003-eca1f88ffd04" /> **After** It's just normal text: <img width="1105" height="63" alt="SCR-20250716-sqxl" src="https://github.com/user-attachments/assets/155e0660-bcab-47c6-8471-7f2cb0fa8d92" />
1 parent bb11e64 commit 0bf4051

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

static/app/components/replays/table/replayTableHeader.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ export default function ReplayTableHeader({columns, replays, onSortClick, sort}:
2626

2727
return (
2828
<SimpleTable.Header>
29-
{columns.map((column, columnIndex) => (
29+
{columns.map(({Header, sortKey}, columnIndex) => (
3030
<SimpleTable.HeaderCell
31-
key={`${column.sortKey}-${columnIndex}`}
32-
handleSortClick={() => column.sortKey && onSortClick?.(column.sortKey)}
33-
sort={column.sortKey && sort?.field === column.sortKey ? sort.kind : undefined}
31+
key={`${sortKey}-${columnIndex}`}
32+
handleSortClick={
33+
onSortClick && sortKey ? () => onSortClick(sortKey) : undefined
34+
}
35+
sort={sortKey && sort?.field === sortKey ? sort.kind : undefined}
3436
>
35-
{typeof column.Header === 'function'
36-
? column.Header({columnIndex, listItemCheckboxState, replays})
37-
: column.Header}
37+
{typeof Header === 'function'
38+
? Header({columnIndex, listItemCheckboxState, replays})
39+
: Header}
3840
</SimpleTable.HeaderCell>
3941
))}
4042
</SimpleTable.Header>

0 commit comments

Comments
 (0)