[Refactor]: added extra param to check isdepend on query build (#4523)

* refactor: added extra param to check isdepend on query build

* refactor: added extra param to check isdepend on query build

* refactor: updated enabled query condition

* refactor: added extra param to check isdepend on query build

* refactor: updated enabled query condition

* chore: clean code
This commit is contained in:
Rajat Dabade 2024-02-13 15:19:15 +05:30 committed by GitHub
parent cff0e1cf1e
commit ad8924ed13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -89,6 +89,8 @@ export default function LogsConnectionStatus(): JSX.Element {
refetchInterval: pollingInterval,
enabled: true,
},
{},
false,
);
const verifyLogsData = (

View File

@ -17,6 +17,7 @@ export const useGetExplorerQueryRange = (
panelType: PANEL_TYPES | null,
options?: UseQueryOptions<SuccessResponse<MetricRangePayloadProps>, Error>,
params?: Record<string, unknown>,
isDependentOnQB = true,
): UseQueryResult<SuccessResponse<MetricRangePayloadProps>, Error> => {
const { isEnabledQuery } = useQueryBuilder();
const { selectedTime: globalSelectedInterval, minTime, maxTime } = useSelector<
@ -32,11 +33,11 @@ export const useGetExplorerQueryRange = (
const isEnabled = useMemo(() => {
if (!options) return isEnabledQuery;
if (typeof options.enabled === 'boolean') {
return isEnabledQuery && options.enabled;
return options.enabled && (!isDependentOnQB || isEnabledQuery);
}
return isEnabledQuery;
}, [options, isEnabledQuery]);
}, [options, isEnabledQuery, isDependentOnQB]);
return useGetQueryRange(
{