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:
parent
2f1e4944de
commit
679410a5cd
1 changed files with 4 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue