Skip to content

Commit

Permalink
fix: 🐛 la fonction de tri par défaut sur le DsfrDataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinette committed Oct 10, 2024
1 parent bb4d8d4 commit a6735f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/DsfrDataTable/DsfrDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const lowestLimit = computed(() => currentPage.value * rowsPerPage.value)
const highestLimit = computed(() => (currentPage.value + 1) * rowsPerPage.value)
function defaultSortFn (a: string | DsfrDataTableRow, b: string | DsfrDataTableRow) {
const key = props.sorted as string
const key = sortedBy.value

Check failure on line 68 in src/components/DsfrDataTable/DsfrDataTable.vue

View workflow job for this annotation

GitHub Actions / Run unit tests and CT tests

'sortedBy' was used before it was defined
// @ts-expect-error TS7015
if (((a as DsfrDataTableRow)[key] ?? a) < ((b as DsfrDataTableRow)[key] ?? b)) {
return -1
Expand All @@ -77,7 +77,7 @@ function defaultSortFn (a: string | DsfrDataTableRow, b: string | DsfrDataTableR
return 0
}
const sortedBy = defineModel<string | undefined>('sortedBy', { default: undefined })
const sortedBy = defineModel<string>('sortedBy', { default: props.sorted })
const sortedDesc = defineModel('sortedDesc', { default: false })
function sortBy (key: string) {
if (!props.sortableRows || (Array.isArray(props.sortableRows) && !props.sortableRows.includes(key))) {
Expand Down

0 comments on commit a6735f8

Please sign in to comment.