Skip to content

Commit

Permalink
[Bug][Table Visualization] Fix first column sort issue
Browse files Browse the repository at this point in the history
Currently, the first column of table vis won't sort. This PR fixes
the bug.

Issue Resolved:
#2827

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
  • Loading branch information
ananzh committed Nov 8, 2022
1 parent 5608f82 commit 3796e3e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const TableVisComponent = ({
const pagination = usePagination(visConfig, rows.length);

const sortedRows = useMemo(() => {
return uiState.sort?.colIndex && uiState.sort.direction
return uiState.sort.colIndex !== null && uiState.sort.direction
? orderBy(rows, columns[uiState.sort.colIndex]?.id, uiState.sort.direction)
: rows;
}, [columns, rows, uiState]);
Expand Down

0 comments on commit 3796e3e

Please sign in to comment.