From 3afbf1c49f4c85fd3fe1c80fe2337202fbd17cd4 Mon Sep 17 00:00:00 2001 From: Geomitron <22552797+Geomitron@users.noreply.github.com> Date: Sat, 10 Apr 2021 20:45:58 -0500 Subject: [PATCH] Prevented empty results from being sorted --- .../components/browse/result-table/result-table.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/components/browse/result-table/result-table.component.ts b/src/app/components/browse/result-table/result-table.component.ts index 71b4d3d..4e1aa8b 100644 --- a/src/app/components/browse/result-table/result-table.component.ts +++ b/src/app/components/browse/result-table/result-table.component.ts @@ -19,7 +19,7 @@ export class ResultTableComponent implements OnInit { @ViewChild(CheckboxDirective, { static: true }) checkboxColumn: CheckboxDirective @ViewChildren('tableRow') tableRows: QueryList - results: SongResult[] + results: SongResult[] = [] activeRowID: number = null sortDirection: 'ascending' | 'descending' = 'descending' sortColumn: 'name' | 'artist' | 'album' | 'genre' | null = null @@ -52,6 +52,7 @@ export class ResultTableComponent implements OnInit { } onColClicked(column: 'name' | 'artist' | 'album' | 'genre') { + if (this.results.length == 0) { return } if (this.sortColumn != column) { this.sortColumn = column this.sortDirection = 'descending'