Skip to content

Commit

Permalink
fix: step interval not getting updated on time range change
Browse files Browse the repository at this point in the history
  • Loading branch information
vikrantgupta25 committed May 21, 2024
1 parent de497bf commit f230fa2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions frontend/src/container/GridCardLayout/GridCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/container/GridCardLayout/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f230fa2

Please sign in to comment.