Skip to content

Commit

Permalink
feat: optimize code
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Jan 8, 2025
1 parent 751203f commit 46cec9d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { i18n } from '@osd/i18n';
import { HttpSetup } from 'opensearch-dashboards/public';
import React, { useEffect, useState } from 'react';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject, of } from 'rxjs';
import { distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
import { DATA_STRUCTURE_META_TYPES, DEFAULT_DATA } from '../../../../data/common';
import {
Expand Down Expand Up @@ -127,7 +127,7 @@ export const createQueryAssistExtension = (
isEnabled$: (dependencies) => {
const query = dependencies.query;
if (!queryAssistantSupportedDatasetTypes.includes(query.dataset?.type || '')) {
return new BehaviorSubject(false);
return of(false);
}
return getAvailableLanguages$(http, data).pipe(map((languages) => languages.length > 0));
},
Expand Down

0 comments on commit 46cec9d

Please sign in to comment.