Merge pull request #630 from buster-so/big-nate/bus-1574-charts-are-not-reflecting-styling-changes-in-real-time

Memoized props should alwasy rerender
This commit is contained in:
Nate Kelley 2025-07-25 15:47:35 -06:00 committed by GitHub
commit deb866b67e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 28 deletions

View File

@ -1,5 +1,6 @@
'use client';
import type React from 'react';
import { useMemo } from 'react';
import { BusterChartJS } from './BusterChartJS';
import { useDatasetOptions } from './chartHooks';
import type {
@ -46,32 +47,18 @@ export const BusterChartComponent: React.FC<BusterChartRenderComponentProps> = (
columnMetadata
});
// biome-ignore lint/correctness/useExhaustiveDependencies: we are content with the current dependencies
const chartProps: BusterChartComponentProps = useMemo(
() => ({
...props,
datasetOptions,
pieMinimumSlicePercentage,
y2AxisKeys,
yAxisKeys,
tooltipKeys,
hasMismatchedTooltipsAndMeasures,
isDownsampled,
numberOfDataPoints,
trendlines
}),
[
props.selectedAxis,
pieMinimumSlicePercentage,
datasetOptions,
y2AxisKeys,
yAxisKeys,
hasMismatchedTooltipsAndMeasures,
tooltipKeys,
isDownsampled,
numberOfDataPoints
]
);
const chartProps: BusterChartComponentProps = {
...props,
datasetOptions,
pieMinimumSlicePercentage,
y2AxisKeys,
yAxisKeys,
tooltipKeys,
hasMismatchedTooltipsAndMeasures,
isDownsampled,
numberOfDataPoints,
trendlines
};
return <BusterChartJS {...chartProps} />;
};

View File

@ -1,3 +1,5 @@
'use client';
import dynamic from 'next/dynamic';
import { PreparingYourRequestLoader } from './LoadingComponents/ChartLoadingComponents';

View File

@ -1,4 +1,6 @@
import React, { useMemo } from 'react';
'use client';
import React from 'react';
import type { BusterMetricData, BusterMetric } from '@/api/asset_interfaces/metric';
import type { DataMetadata } from '@buster/server-shared/metrics';
import { BusterChartDynamic } from '@/components/ui/charts/BusterChartDynamic';