From 46cec9d2f294bc41d0212630a8547357da233905 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Wed, 8 Jan 2025 18:11:39 +0800 Subject: [PATCH] feat: optimize code Signed-off-by: SuZhou-Joe --- .../public/query_assist/utils/create_extension.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx index 0702d306d4d4..926d89b05204 100644 --- a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx +++ b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx @@ -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 { @@ -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)); },