diff --git a/src/plugins/data/public/search/sync_search_strategy.ts b/src/plugins/data/public/search/sync_search_strategy.ts index 352e19b5875e8..b895a177d8608 100644 --- a/src/plugins/data/public/search/sync_search_strategy.ts +++ b/src/plugins/data/public/search/sync_search_strategy.ts @@ -32,12 +32,13 @@ export interface ISyncSearchRequest extends IKibanaSearchRequest { export const syncSearchStrategyProvider: TSearchStrategyProvider = ( context: ISearchContext ): ISearchStrategy => { + const loadingCount$ = new BehaviorSubject(0); + context.core.http.addLoadingCountSource(loadingCount$); + const search: ISearch = ( request: ISyncSearchRequest, options: ISearchOptions = {} ) => { - const loadingCount$ = new BehaviorSubject(0); - context.core.http.addLoadingCountSource(loadingCount$); loadingCount$.next(loadingCount$.getValue() + 1); const response: Promise = context.core.http.fetch({