Skip to content

Commit

Permalink
fix(insights): LineGraph infinite updates (#25555)
Browse files Browse the repository at this point in the history
  • Loading branch information
skoob13 authored Oct 15, 2024
1 parent 83101b7 commit 2cb4fd9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'chartjs-adapter-dayjs-3'

import { LegendOptions } from 'chart.js'
import { DeepPartial } from 'chart.js/dist/types/utils'
import annotationPlugin, { AnnotationPluginOptions } from 'chartjs-plugin-annotation'
import annotationPlugin, { AnnotationOptions } from 'chartjs-plugin-annotation'
import ChartDataLabels from 'chartjs-plugin-datalabels'
import ChartjsPluginStacked100, { ExtendedChartData } from 'chartjs-plugin-stacked100'
import clsx from 'clsx'
Expand Down Expand Up @@ -279,7 +279,7 @@ export function LineGraph_({
hideYAxis,
legend = { display: false },
yAxisScaleType,
alertLines = [],
alertLines,
}: LineGraphProps): JSX.Element {
let datasets = _datasets

Expand Down Expand Up @@ -397,8 +397,8 @@ export function LineGraph_({
}
}

const annotations = alertLines.reduce((acc, { value }, idx) => {
acc[`${idx}`] = {
const annotations = (alertLines || []).reduce((acc, { value }, idx) => {
acc[idx] = {
type: 'line',
yMin: value,
yMax: value,
Expand All @@ -408,7 +408,7 @@ export function LineGraph_({
}

return acc
}, {} as AnnotationPluginOptions['annotations'])
}, {} as Record<string, AnnotationOptions>)

datasets = datasets.map(processDataset)

Expand Down

0 comments on commit 2cb4fd9

Please sign in to comment.