Skip to content

Commit cf0973e

Browse files
committed
fix(select): Fixed selected option sometimes not appearing
1 parent df06762 commit cf0973e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/modules/select/classes/select-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export abstract class SuiSelectBase<T, U> implements AfterContentInit {
197197
} else if (this.searchService.optionsLookup) {
198198
return o => this.labelGetter(o);
199199
} else {
200-
return o => this.searchService.highlightMatches(this.labelGetter(o), this.query != undefined ? this.query : "");
200+
return o => this.searchService.highlightMatches(this.labelGetter(o), this.query || "");
201201
}
202202
}
203203

src/modules/select/components/select.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { ISelectRenderedOption } from "./select-option";
1313
[hidden]="!isSearchable || isSearchExternal">
1414
1515
<!-- Placeholder text -->
16-
<div *ngIf="selectedOption == undefined" class="default text" [class.filtered]="query != undefined">{{ placeholder }}</div>
16+
<div *ngIf="selectedOption == undefined" class="default text" [class.filtered]="query">{{ placeholder }}</div>
1717
<!-- Selected item -->
18-
<div class="text" [class.filtered]="query != undefined || selectedOption == undefined">
18+
<div class="text" [class.filtered]="query || selectedOption == undefined">
1919
<span #optionTemplateSibling></span>
2020
<span *ngIf="!optionTemplate && selectedOption != undefined" [innerHTML]="configuredFormatter(selectedOption)"></span>
2121
</div>
@@ -132,7 +132,7 @@ export class SuiSelect<T, U> extends SuiSelectBase<T, U> implements ICustomValue
132132
this.onAvailableOptionsRendered();
133133
}
134134

135-
if (this.selectedOption && this.optionTemplate) {
135+
if (this.selectedOption != undefined && this.optionTemplate) {
136136
this.drawTemplate(this._optionTemplateSibling, this.selectedOption);
137137
}
138138
}

0 commit comments

Comments
 (0)