add secondary name sorting as tie breaker in client and project tables

This commit is contained in:
Gregor Vostrak
2026-07-08 15:20:00 +02:00
parent 27f5d4a200
commit fa8d350c4a
2 changed files with 7 additions and 1 deletions

View File

@@ -44,11 +44,14 @@ const projectCountMap = computed(() => {
return map; return map;
}); });
// Name is always the secondary sort so rows with equal values render
// alphabetically instead of in API (created_at) order.
const sorting = computed<SortingState>(() => [ const sorting = computed<SortingState>(() => [
{ {
id: props.sortColumn, id: props.sortColumn,
desc: props.sortDirection === 'desc', desc: props.sortDirection === 'desc',
}, },
...(props.sortColumn !== 'name' ? [{ id: 'name', desc: false }] : []),
]); ]);
const columns = computed(() => [ const columns = computed(() => [

View File

@@ -57,12 +57,15 @@ const clientNameMap = computed(() => {
return map; return map;
}); });
// Convert sort props to TanStack Table format // Convert sort props to TanStack Table format.
// Name is always the secondary sort so rows with equal values render
// alphabetically instead of in API (created_at) order.
const sorting = computed<SortingState>(() => [ const sorting = computed<SortingState>(() => [
{ {
id: props.sortColumn, id: props.sortColumn,
desc: props.sortDirection === 'desc', desc: props.sortDirection === 'desc',
}, },
...(props.sortColumn !== 'name' ? [{ id: 'name', desc: false }] : []),
]); ]);
// Define column accessors for sorting. // Define column accessors for sorting.