Skip to content

Commit

Permalink
Only register observable once
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson committed Feb 3, 2020
1 parent 6188c74 commit e5d7d58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/data/public/search/sync_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ export interface ISyncSearchRequest extends IKibanaSearchRequest {
export const syncSearchStrategyProvider: TSearchStrategyProvider<typeof SYNC_SEARCH_STRATEGY> = (
context: ISearchContext
): ISearchStrategy<typeof SYNC_SEARCH_STRATEGY> => {
const loadingCount$ = new BehaviorSubject(0);
context.core.http.addLoadingCountSource(loadingCount$);

const search: ISearch<typeof SYNC_SEARCH_STRATEGY> = (
request: ISyncSearchRequest,
options: ISearchOptions = {}
) => {
const loadingCount$ = new BehaviorSubject(0);
context.core.http.addLoadingCountSource(loadingCount$);
loadingCount$.next(loadingCount$.getValue() + 1);

const response: Promise<IKibanaSearchResponse> = context.core.http.fetch({
Expand Down

0 comments on commit e5d7d58

Please sign in to comment.