mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
fix: performance degradation when scrolling
This commit is contained in:
@@ -29,6 +29,7 @@ import {ContextMenuService} from '../../menu/context/context-menu.service';
|
||||
import {SettingsProvider} from '../../settings/settings.provider';
|
||||
import {DataRoutingService} from '../data-routing.service';
|
||||
import {DataProvider} from '../data.provider';
|
||||
import {DataSourceRefreshed} from './data-list.component';
|
||||
|
||||
/**
|
||||
* SearchPageComponent queries things and shows list of things as search results and filter as context menu
|
||||
@@ -71,6 +72,10 @@ export class SearchPageComponent implements OnInit {
|
||||
* Time to wait for search query if search text is changing
|
||||
*/
|
||||
searchQueryDueTime = 1000;
|
||||
/**
|
||||
* Search response only ever contains a single SCThingType
|
||||
*/
|
||||
singleTypeResponse = false;
|
||||
/**
|
||||
* Api query sorting
|
||||
*/
|
||||
@@ -183,6 +188,7 @@ export class SearchPageComponent implements OnInit {
|
||||
|
||||
return this.dataProvider.search(searchOptions)
|
||||
.then(async (result) => {
|
||||
this.singleTypeResponse = result.facets.find(facet => facet.field === 'type')?.buckets.length === 1;
|
||||
if (append) {
|
||||
let items = await this.items;
|
||||
// append results
|
||||
@@ -219,10 +225,10 @@ export class SearchPageComponent implements OnInit {
|
||||
* Loads next page of things
|
||||
*/
|
||||
// tslint:disable-next-line:no-any
|
||||
async loadMore(event: any): Promise<void> {
|
||||
async loadMore(finished: DataSourceRefreshed): Promise<void> {
|
||||
this.from += this.pageSize;
|
||||
await this.fetchAndUpdateItems(true);
|
||||
event.target.complete();
|
||||
finished(await this.items);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user