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(() => {