fix: feature flag is added when we are switching the tab (#2930)

This commit is contained in:
Palash Gupta 2023-06-21 16:46:11 +05:30 committed by GitHub
parent cf05345ccd
commit 3f4cd130ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -4,8 +4,11 @@ import { PANEL_TYPES } from 'constants/queryBuilder';
import { QueryBuilder } from 'container/QueryBuilder';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
import { AlertTypes } from 'types/api/alerts/alertTypes';
import { EQueryType } from 'types/common/dashboard';
import AppReducer from 'types/reducer/app';
import ChQuerySection from './ChQuerySection';
import PromqlSection from './PromqlSection';
@ -20,8 +23,14 @@ function QuerySection({
// init namespace for translations
const { t } = useTranslation('alerts');
const { featureResponse } = useSelector<AppState, AppReducer>(
(state) => state.app,
);
const handleQueryCategoryChange = (queryType: string): void => {
setQueryCategory(queryType as EQueryType);
featureResponse.refetch().then(() => {
setQueryCategory(queryType as EQueryType);
});
};
const renderPromqlUI = (): JSX.Element => <PromqlSection />;

View File

@ -20,6 +20,7 @@ import AppActions from 'types/actions';
import { Widgets } from 'types/api/dashboard/getAll';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { EQueryType } from 'types/common/dashboard';
import AppReducer from 'types/reducer/app';
import DashboardReducer from 'types/reducer/dashboards';
import ClickHouseQueryContainer from './QueryBuilder/clickHouse';
@ -32,6 +33,9 @@ function QuerySection({
}: QueryProps): JSX.Element {
const { currentQuery, redirectWithQueryBuilderData } = useQueryBuilder();
const urlQuery = useUrlQuery();
const { featureResponse } = useSelector<AppState, AppReducer>(
(state) => state.app,
);
const { dashboards } = useSelector<AppState, DashboardReducer>(
(state) => state.dashboards,
@ -72,7 +76,9 @@ function QuerySection({
const handleQueryCategoryChange = (qCategory: string): void => {
const currentQueryType = qCategory as EQueryType;
handleStageQuery({ ...currentQuery, queryType: currentQueryType });
featureResponse.refetch().then(() => {
handleStageQuery({ ...currentQuery, queryType: currentQueryType });
});
};
const handleRunQuery = (): void => {