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 {