Fix handling of the empty preset option

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/12/head
trivernis 3 years ago
parent a5a0134c56
commit 341c1a35d6
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -5,7 +5,7 @@
<mat-form-field *ngIf="this.availablePresets.length > 0" class="preset-selection">
<mat-label>Preset</mat-label>
<mat-select (selectionChange)="this.selectPreset($event.value)" [value]="this.previousId">
<mat-option [value]="this.emptyPreset"></mat-option>
<mat-option [value]="-1"></mat-option>
<mat-option *ngFor="let preset of this.availablePresets"
[matTooltipShowDelay]="1000"
[matTooltip]="preset.toString()"

@ -116,8 +116,8 @@ export class SortDialogComponent implements OnInit {
}
public selectPreset(presetId: number): void {
const preset = this.availablePresets.find(p => p.id == presetId);
const preset = this.availablePresets.find(p => p.id == presetId) ?? this.emptyPreset;
if (preset) {
this.sortingPreset.setData(JSON.parse(JSON.stringify(preset.rawData)));
this.previousId = preset.id;

Loading…
Cancel
Save