Skip to content

Commit f6f60b6

Browse files
author
CopperGiraffe
authored
fix: améliore le code
1 parent 7f2d700 commit f6f60b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/DsfrDataTable/DsfrDataTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const lowestLimit = computed(() => currentPage.value * rowsPerPage.value)
6565
const highestLimit = computed(() => (currentPage.value + 1) * rowsPerPage.value)
6666
6767
function defaultSortFn (a: string | DsfrDataTableRow, b: string | DsfrDataTableRow) {
68-
const key = sortedBy.value === undefined ? props.sorted : sortedBy.value
68+
const key = sortedBy.value ?? props.sorted
6969
// @ts-expect-error TS7015
7070
if (((a as DsfrDataTableRow)[key] ?? a) < ((b as DsfrDataTableRow)[key] ?? b)) {
7171
return -1
@@ -77,7 +77,7 @@ function defaultSortFn (a: string | DsfrDataTableRow, b: string | DsfrDataTableR
7777
return 0
7878
}
7979
80-
const sortedBy = defineModel<string>('sortedBy', { default: undefined })
80+
const sortedBy = defineModel<string | undefined>('sortedBy', { default: undefined })
8181
const sortedDesc = defineModel('sortedDesc', { default: false })
8282
function sortBy (key: string) {
8383
if (!props.sortableRows || (Array.isArray(props.sortableRows) && !props.sortableRows.includes(key))) {

0 commit comments

Comments
 (0)