Stat: Cut the top of the chart issue (#88640)

* fix(stat): update config on range change
This commit is contained in:
Ihor Yeromin
2024-06-04 19:09:10 +02:00
committed by GitHub
parent f1dce0c7d7
commit 618c51e193

View File

@@ -86,7 +86,12 @@ export class Sparkline extends PureComponent<SparklineProps, State> {
let rebuildConfig = false;
if (prevProps.sparkline !== this.props.sparkline) {
rebuildConfig = !compareDataFrameStructures(this.state.alignedDataFrame, prevState.alignedDataFrame);
const isStructureChanged = !compareDataFrameStructures(this.state.alignedDataFrame, prevState.alignedDataFrame);
const isRangeChanged = !isEqual(
alignedDataFrame.fields[1].state?.range,
prevState.alignedDataFrame.fields[1].state?.range
);
rebuildConfig = isStructureChanged || isRangeChanged;
} else {
rebuildConfig = !isEqual(prevProps.config, this.props.config);
}