Skip to content

Commit c844dd6

Browse files
fix(grid): add nullish for set items
1 parent 33cc811 commit c844dd6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

projects/angular/components/ui-grid/src/filters/ui-grid-dropdown-filter.directive.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export class UiGridDropdownFilterDirective<T> extends UiGridFilterDirective<T> i
5252
*
5353
*/
5454
@Input()
55-
set items(value: IDropdownOption[]) {
56-
this._items = value;
57-
this.suggestItems = value.map((item, idx) => ({
55+
set items(value: IDropdownOption[] | null) {
56+
this._items = value ?? [];
57+
this.suggestItems = this._items.map((item, idx) => ({
5858
id: idx + 1,
5959
text: item.label,
6060
data: item.value,
@@ -119,7 +119,7 @@ export class UiGridDropdownFilterDirective<T> extends UiGridFilterDirective<T> i
119119
*/
120120
suggestItems: ISuggestDropdownValueData[] = [];
121121

122-
private _items?: IDropdownOption[];
122+
private _items: IDropdownOption[] = [];
123123
private _value: FilterDropdownPossibleOption;
124124
private _multi = false;
125125

@@ -155,7 +155,7 @@ export class UiGridDropdownFilterDirective<T> extends UiGridFilterDirective<T> i
155155
}
156156

157157
findDropDownOptionBySuggestValue(suggestValue: ISuggestDropdownValueData) {
158-
return this.items.find(item => isEqual(item.value, suggestValue.data));
158+
return this._items.find(item => isEqual(item.value, suggestValue.data));
159159
}
160160

161161
get hasValue() {

0 commit comments

Comments
 (0)