fix: step interval not getting updated on time range change (#5040)

This commit is contained in:
Vikrant Gupta 2024-05-23 22:44:28 +05:30 committed by GitHub
parent da74619a46
commit 3b599ea41a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import { useIntersectionObserver } from 'hooks/useIntersectionObserver';
import { getDashboardVariables } from 'lib/dashbaordVariables/getDashboardVariables';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import getTimeString from 'lib/getTimeString';
import { isEqual } from 'lodash-es';
import isEmpty from 'lodash-es/isEmpty';
import { useDashboard } from 'providers/Dashboard/Dashboard';
import { memo, useEffect, useRef, useState } from 'react';
@ -125,6 +126,16 @@ function GridCardGraph({
};
});
useEffect(() => {
if (!isEqual(updatedQuery, requestData.query)) {
setRequestData((prev) => ({
...prev,
query: updatedQuery,
}));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [updatedQuery]);
const queryResponse = useGetQueryRange(
{
...requestData,

View File

@ -34,7 +34,8 @@ export const CardContainer = styled.div<Props>`
height: 100%;
display: flex;
justify-content: space-between;
background: var(--bg-ink-400);
background: ${({ isDarkMode }): string =>
isDarkMode ? 'var(--bg-ink-400)' : 'var(--bg-vanilla-300)'};
align-items: center;
overflow: hidden;
}