fix: move new Set<string>() default prop to module-level constant in CandleChart

Move the inline 'new Set<string>()' default prop to a module-level constant
(EMPTY_STRING_SET) to prevent unnecessary Set instance creation on every render,
which could cause unnecessary re-renders in children or effects that depend on
reference equality.
This commit is contained in:
Marko Djordjevic 2026-02-18 15:25:15 +01:00
parent 2f1e4944de
commit 679410a5cd

View file

@ -59,6 +59,9 @@ const PREDEFINED_LABEL_COLORS = [
'#f97316', // orange
];
// === Default Props ===
const EMPTY_STRING_SET = new Set<string>();
interface DrawingState {
tool: 'line' | 'rectangle';
firstPoint: { time: Time; price: number };
@ -173,7 +176,7 @@ const CandleChart = forwardRef<CandleChartHandle, CandleChartProps>(
perCandlePredictions = [],
predictionSpans = [],
confidenceThreshold = 0.5,
selectedLabels = new Set<string>(),
selectedLabels = EMPTY_STRING_SET,
modelInfo = null,
predictionSummary = null,
showOnlyDisagreements = false,