Skip to content

Commit

Permalink
protect duplicated calls
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <joshuali925@gmail.com>
  • Loading branch information
joshuali925 committed Jul 5, 2024
1 parent 9f43eba commit a43fcdc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion public/query_assist/utils/create_extension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { HttpSetup } from 'opensearch-dashboards/public';
import React, { useEffect, useState } from 'react';
import { of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { distinctUntilChanged, switchMap, map } from 'rxjs/operators';
import { QueryEditorExtensionConfig } from '../../../../../src/plugins/data/public/ui/query_editor';
import { QueryEditorExtensionDependencies } from '../../../../../src/plugins/data/public/ui/query_editor/query_editor_extensions/query_editor_extension';
import { API } from '../../../common';
Expand All @@ -25,6 +25,7 @@ const getAvailableLanguages$ = (
http: HttpSetup
) =>
connectionsService.getSelectedConnection$().pipe(
distinctUntilChanged(),
switchMap(async (connection) => {
const dataSourceId = connection?.id;
const cached = availableLanguagesByDataSource.get(dataSourceId);
Expand Down

0 comments on commit a43fcdc

Please sign in to comment.