Skip to content

Commit 98683f1

Browse files
committed
Avoid flash of stale content
1 parent 28ca209 commit 98683f1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/components/search-input.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export default class SearchInput extends Component {
5757

5858
@action onfocus() {
5959
if (this.query.length > 0 && this.searchService.hasStaleResults()) {
60+
// clearing the results avoids a flash of stale content while the search
61+
// is performed
62+
this.searchService.clearResults();
6063
this.searchService.search.perform(this.query);
6164
}
6265

app/services/search.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ export default Service.extend({
5454
return this._lastQueriedProjectVersion !== null
5555
&& this._projectVersion !== this._lastQueriedProjectVersion;
5656
},
57+
58+
clearResults() {
59+
set(this, 'results', emberArray());
60+
}
5761
});

0 commit comments

Comments
 (0)