Skip to content

Commit e2c2f1f

Browse files
authored
chore: updated ui sample to work with latest ObservableArray changes (#10065)
1 parent 7860d51 commit e2c2f1f

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

apps/ui/src/main-page-view-model.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ export class MainPageViewModel extends TestPageMainViewModel {
7070

7171
private filterListView(value: string) {
7272
if (!MainPageViewModel.checkIfStringIsNullEmptyOrUndefined(value)) {
73-
let array = MainPageViewModel.ALL_EXAMPLES.filter((testExample, index, array) => {
74-
return MainPageViewModel.stringContains(testExample.path.toLowerCase(), value.toLowerCase()) || MainPageViewModel.stringContains(testExample.name.toLowerCase(), value.toLowerCase());
75-
});
73+
let array = Array.from(
74+
MainPageViewModel.ALL_EXAMPLES.filter((testExample, index, array) => {
75+
return MainPageViewModel.stringContains(testExample.path.toLowerCase(), value.toLowerCase()) || MainPageViewModel.stringContains(testExample.name.toLowerCase(), value.toLowerCase());
76+
})
77+
);
7678
this.filteredListOfExamples = new ObservableArray(array);
7779
} else {
7880
this.filteredListOfExamples = null;

apps/ui/src/search-bar/issue-5039-view-model.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export class Issue5039ViewModel extends Observable {
2020
}
2121

2222
filter(value: string = '') {
23+
const filteredItems = this._items.filter((item) => -1 !== item.indexOf(value));
2324
this.items.splice(0, this.items.length); // remove all items
24-
this.items.push(this._items.filter((i) => -1 !== i.indexOf(value)));
25+
this.items.push(...filteredItems);
2526
}
2627
}

0 commit comments

Comments
 (0)