fix: resolve TypeScript error by renaming conflicting lineHit variable
This commit is contained in:
parent
08bd9625ae
commit
025cf6d973
1 changed files with 7 additions and 7 deletions
|
|
@ -763,25 +763,25 @@ const CandleChart = forwardRef<CandleChartHandle, CandleChartProps>(
|
|||
const timestamp = typeof time === 'string' ? Date.parse(time) / 1000 : (time as number);
|
||||
|
||||
// First, check for line hit using primitives' hitTest
|
||||
let lineHit: { id: number; primitive: TrendLine } | null = null;
|
||||
let deleteLineHit: { id: number; primitive: TrendLine } | null = null;
|
||||
linePrimitivesRef.current.forEach((primitive, id) => {
|
||||
const hit = primitive.hitTest(timeCoordinate, priceCoordinate);
|
||||
if (hit) {
|
||||
lineHit = { id, primitive };
|
||||
deleteLineHit = { id, primitive };
|
||||
}
|
||||
});
|
||||
|
||||
if (lineHit) {
|
||||
if (deleteLineHit) {
|
||||
// Delete the clicked line
|
||||
try {
|
||||
const response = await fetch(`/api/annotations/${lineHit.id}`, {
|
||||
const response = await fetch(`/api/annotations/${deleteLineHit.id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
seriesRef.current!.detachPrimitive(lineHit.primitive);
|
||||
linePrimitivesRef.current.delete(lineHit.id);
|
||||
if (selectedLineId === lineHit.id) {
|
||||
seriesRef.current!.detachPrimitive(deleteLineHit.primitive);
|
||||
linePrimitivesRef.current.delete(deleteLineHit.id);
|
||||
if (selectedLineId === deleteLineHit.id) {
|
||||
setSelectedLineId(null);
|
||||
}
|
||||
await fetchAnnotations();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue