diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-02-04 16:44:53 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-02-13 16:35:24 +0100 |
commit | 9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110 (patch) | |
tree | f38e6f83a9d892a99f930c0a25b1a405e679cd4a /client/src/app/header/suggestions.component.ts | |
parent | ece3029bd99a76b3c48a1cc8c58914c5cf61f106 (diff) | |
download | PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.tar.gz PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.tar.zst PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.zip |
Improve search typeahead performance and use native events
Diffstat (limited to 'client/src/app/header/suggestions.component.ts')
-rw-r--r-- | client/src/app/header/suggestions.component.ts | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/client/src/app/header/suggestions.component.ts b/client/src/app/header/suggestions.component.ts index fac7fe2f9..ee3ef73c2 100644 --- a/client/src/app/header/suggestions.component.ts +++ b/client/src/app/header/suggestions.component.ts | |||
@@ -1,16 +1,10 @@ | |||
1 | import { Input, QueryList, Component, Output, AfterViewInit, EventEmitter, ViewChildren } from '@angular/core' | 1 | import { Input, QueryList, Component, Output, AfterViewInit, EventEmitter, ViewChildren, ChangeDetectionStrategy } from '@angular/core' |
2 | import { SuggestionComponent } from './suggestion.component' | 2 | import { SuggestionComponent } from './suggestion.component' |
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
5 | selector: 'my-suggestions', | 5 | selector: 'my-suggestions', |
6 | template: ` | 6 | templateUrl: './suggestions.component.html', |
7 | <ul role="listbox" class="p-0 m-0"> | 7 | changeDetection: ChangeDetectionStrategy.OnPush |
8 | <li *ngFor="let result of results; let i = index" class="d-flex flex-justify-start flex-items-center p-0 f5" | ||
9 | role="option" aria-selected="true" (mouseenter)="hoverItem(i)"> | ||
10 | <my-suggestion [result]="result" [highlight]="highlight"></my-suggestion> | ||
11 | </li> | ||
12 | </ul> | ||
13 | ` | ||
14 | }) | 8 | }) |
15 | export class SuggestionsComponent implements AfterViewInit { | 9 | export class SuggestionsComponent implements AfterViewInit { |
16 | @Input() results: any[] | 10 | @Input() results: any[] |
@@ -20,7 +14,7 @@ export class SuggestionsComponent implements AfterViewInit { | |||
20 | 14 | ||
21 | ngAfterViewInit () { | 15 | ngAfterViewInit () { |
22 | this.listItems.changes.subscribe( | 16 | this.listItems.changes.subscribe( |
23 | val => this.init.emit({ items: this.listItems }) | 17 | _ => this.init.emit({ items: this.listItems }) |
24 | ) | 18 | ) |
25 | } | 19 | } |
26 | 20 | ||