From 6dedb621d13ee2eaaeb5dc627848d7d7a521101b Mon Sep 17 00:00:00 2001 From: omgbeez <251408589+omgbeez@users.noreply.github.com> Date: Fri, 20 Feb 2026 16:09:56 -0500 Subject: [PATCH] Fix sorting logic to default to descending order for new properties --- client/src/app/torrent-table/torrent-table.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts index 9125930..c19c8c0 100644 --- a/client/src/app/torrent-table/torrent-table.component.ts +++ b/client/src/app/torrent-table/torrent-table.component.ts @@ -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 {