Reduce search requests (#1786)

pull/1787/head
Thomas Kaul 2 years ago committed by GitHub
parent 7c6ff776d9
commit 0d92b8d8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -163,10 +163,6 @@ export class CoinGeckoService implements DataProviderInterface {
public async search(aQuery: string): Promise<{ items: LookupItem[] }> {
let items: LookupItem[] = [];
if (aQuery.length <= 2) {
return { items };
}
try {
const get = bent(
`${this.URL}/search?query=${aQuery}`,

@ -264,6 +264,10 @@ export class DataProviderService {
const promises: Promise<{ items: LookupItem[] }>[] = [];
let lookupItems: LookupItem[] = [];
if (aQuery?.length < 2) {
return { items: lookupItems };
}
for (const dataSource of this.configurationService.get('DATA_SOURCES')) {
promises.push(
this.getDataProvider(DataSource[dataSource]).search(aQuery)

@ -158,10 +158,6 @@ export class EodHistoricalDataService implements DataProviderInterface {
public async search(aQuery: string): Promise<{ items: LookupItem[] }> {
let items: LookupItem[] = [];
if (aQuery.length <= 2) {
return { items };
}
try {
const get = bent(
`${this.URL}/search/${aQuery}?api_token=${this.apiKey}`,

@ -243,11 +243,10 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
this.filteredLookupItemsObservable = this.activityForm.controls[
'searchSymbol'
].valueChanges.pipe(
startWith(''),
debounceTime(400),
distinctUntilChanged(),
switchMap((query: string) => {
if (isString(query)) {
if (isString(query) && query.length > 1) {
const filteredLookupItemsObservable =
this.dataService.fetchSymbols(query);

Loading…
Cancel
Save