Fix sorting logic to default to descending order for new properties

This commit is contained in:
omgbeez 2026-02-20 16:09:56 -05:00 committed by Clifford Roche
parent 3eda321d64
commit 6dedb621d1

View file

@ -96,9 +96,12 @@ export class TorrentTableComponent implements OnInit {
}
public sort(property: string): void {
const isSameProperty = this.sortProperty === property;
this.sortProperty = property;
this.sortDirection = isSameProperty ? (this.sortDirection === 'asc' ? 'desc' : 'asc') : this.sortDirection;
if (this.sortProperty === property) {
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
} else {
this.sortProperty = property;
this.sortDirection = 'desc';
}
// Persist sort settings
try {