Skip to content

Commit 38449b9

Browse files
Copilothotlong
andcommitted
Fix code review issues: case-insensitive sorting and optimize dependencies
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 123cf05 commit 38449b9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/ui/src/components/grid/GridView.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ export function GridView({
163163
} else if (column.type === 'boolean') {
164164
comparison = (aVal ? 1 : 0) - (bVal ? 1 : 0)
165165
} else {
166-
// Text comparison
167-
comparison = String(aVal).localeCompare(String(bVal))
166+
// Text comparison (case-insensitive)
167+
comparison = String(aVal).localeCompare(String(bVal), undefined, { sensitivity: 'base' })
168168
}
169169

170170
if (comparison !== 0) {
@@ -199,7 +199,8 @@ export function GridView({
199199
groups[groupValue].push(row)
200200
})
201201
return { groupedData: groups, rowIndexMap: indexMap }
202-
}, [data, enableGrouping, groupByColumn, sorts, columns, enableSorting])
202+
// eslint-disable-next-line react-hooks/exhaustive-deps
203+
}, [data, enableGrouping, groupByColumn, sorts, enableSorting])
203204

204205
const [expandedGroups, setExpandedGroups] = React.useState<Set<string>>(
205206
new Set(Object.keys(groupedData))

0 commit comments

Comments
 (0)