From 440043518cd48100db0e10c18c3fe3b1ec7970b1 Mon Sep 17 00:00:00 2001 From: Marko Djordjevic Date: Wed, 18 Feb 2026 20:42:12 +0100 Subject: [PATCH] code-review-fix task 12.9: add activeChartId to primitive cleanup effect dependency arrays in CandleChart --- src/components/CandleChart.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/CandleChart.tsx b/src/components/CandleChart.tsx index d3605f5..f5901bb 100644 --- a/src/components/CandleChart.tsx +++ b/src/components/CandleChart.tsx @@ -1072,7 +1072,7 @@ const CandleChart = forwardRef( return () => { window.removeEventListener('keydown', handleKeyDown); }; - }, [drawingState]); + }, [drawingState, activeChartId]); // Manage TrendLine primitives for saved line annotations useEffect(() => { @@ -1126,7 +1126,7 @@ const CandleChart = forwardRef( linePrimitivesRef.current.set(annotation.id, trendLine); } }); - }, [annotations, annotationTypes, selectedColor]); + }, [annotations, annotationTypes, selectedColor, activeChartId]); // Manage RectangleDrawingPrimitive for saved rectangle annotations useEffect(() => { @@ -1174,7 +1174,7 @@ const CandleChart = forwardRef( rectanglePrimitivesRef.current.set(annotation.id, rectangle); } }); - }, [annotations, annotationTypes, selectedColor]); + }, [annotations, annotationTypes, selectedColor, activeChartId]); // Fetch data on mount and when chart switches useEffect(() => {