code-review-fix task 12.9: add activeChartId to primitive cleanup effect dependency arrays in CandleChart

This commit is contained in:
Marko Djordjevic 2026-02-18 20:42:12 +01:00
parent 3f6bcd5c7d
commit 440043518c

View file

@ -1072,7 +1072,7 @@ const CandleChart = forwardRef<CandleChartHandle, CandleChartProps>(
return () => { return () => {
window.removeEventListener('keydown', handleKeyDown); window.removeEventListener('keydown', handleKeyDown);
}; };
}, [drawingState]); }, [drawingState, activeChartId]);
// Manage TrendLine primitives for saved line annotations // Manage TrendLine primitives for saved line annotations
useEffect(() => { useEffect(() => {
@ -1126,7 +1126,7 @@ const CandleChart = forwardRef<CandleChartHandle, CandleChartProps>(
linePrimitivesRef.current.set(annotation.id, trendLine); linePrimitivesRef.current.set(annotation.id, trendLine);
} }
}); });
}, [annotations, annotationTypes, selectedColor]); }, [annotations, annotationTypes, selectedColor, activeChartId]);
// Manage RectangleDrawingPrimitive for saved rectangle annotations // Manage RectangleDrawingPrimitive for saved rectangle annotations
useEffect(() => { useEffect(() => {
@ -1174,7 +1174,7 @@ const CandleChart = forwardRef<CandleChartHandle, CandleChartProps>(
rectanglePrimitivesRef.current.set(annotation.id, rectangle); rectanglePrimitivesRef.current.set(annotation.id, rectangle);
} }
}); });
}, [annotations, annotationTypes, selectedColor]); }, [annotations, annotationTypes, selectedColor, activeChartId]);
// Fetch data on mount and when chart switches // Fetch data on mount and when chart switches
useEffect(() => { useEffect(() => {