diff --git a/frontend/src/container/QueryBuilder/components/Query/Query.tsx b/frontend/src/container/QueryBuilder/components/Query/Query.tsx index e35086f3b0..23c5f09528 100644 --- a/frontend/src/container/QueryBuilder/components/Query/Query.tsx +++ b/frontend/src/container/QueryBuilder/components/Query/Query.tsx @@ -82,10 +82,6 @@ export const Query = memo(function Query({ entityVersion: version, }); - const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [ - pathname, - ]); - const handleChangeAggregateEvery = useCallback( (value: IBuilderQuery['stepInterval']) => { handleChangeQueryData('stepInterval', value); @@ -457,7 +453,7 @@ export const Query = memo(function Query({ )} - {isLogsExplorerPage ? ( + {query.dataSource === DataSource.LOGS ? ( (false); - const { pathname } = useLocation(); - const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [ - pathname, + const isLogsDataSource = useMemo(() => query.dataSource === DataSource.LOGS, [ + query.dataSource, ]); const memoizedSearchParams = useMemo( @@ -235,7 +232,7 @@ function QueryBuilderSearchV2( }, { queryKey: [searchParams], - enabled: isQueryEnabled && !isLogsExplorerPage, + enabled: isQueryEnabled && !isLogsDataSource, }, ); @@ -250,7 +247,7 @@ function QueryBuilderSearchV2( }, { queryKey: [suggestionsParams], - enabled: isQueryEnabled && isLogsExplorerPage, + enabled: isQueryEnabled && isLogsDataSource, }, ); @@ -651,7 +648,7 @@ function QueryBuilderSearchV2( useEffect(() => { if (currentState === DropdownState.ATTRIBUTE_KEY) { const { tagKey } = getTagToken(searchValue); - if (isLogsExplorerPage) { + if (isLogsDataSource) { // add the user typed option in the dropdown to select that and move ahead irrespective of the matches and all setDropdownOptions([ ...(!isEmpty(tagKey) && @@ -756,7 +753,7 @@ function QueryBuilderSearchV2( currentFilterItem?.key?.dataType, currentState, data?.payload?.attributeKeys, - isLogsExplorerPage, + isLogsDataSource, searchValue, suggestionsData?.payload?.attributes, ]);