From 679410a5cdacaa5c0e08577f73f9510a805abbb0 Mon Sep 17 00:00:00 2001 From: Marko Djordjevic Date: Wed, 18 Feb 2026 15:25:15 +0100 Subject: [PATCH] fix: move new Set() default prop to module-level constant in CandleChart Move the inline 'new Set()' 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. --- src/components/CandleChart.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/CandleChart.tsx b/src/components/CandleChart.tsx index 3f8a07f..c2207d2 100644 --- a/src/components/CandleChart.tsx +++ b/src/components/CandleChart.tsx @@ -59,6 +59,9 @@ const PREDEFINED_LABEL_COLORS = [ '#f97316', // orange ]; +// === Default Props === +const EMPTY_STRING_SET = new Set(); + interface DrawingState { tool: 'line' | 'rectangle'; firstPoint: { time: Time; price: number }; @@ -173,7 +176,7 @@ const CandleChart = forwardRef( perCandlePredictions = [], predictionSpans = [], confidenceThreshold = 0.5, - selectedLabels = new Set(), + selectedLabels = EMPTY_STRING_SET, modelInfo = null, predictionSummary = null, showOnlyDisagreements = false,