Skip to content

Commit

Permalink
keep fidelity with refactored class component
Browse files Browse the repository at this point in the history
  • Loading branch information
crespocarlos committed Dec 12, 2024
1 parent e18b655 commit 5706db0
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import moment from 'moment';
import * as React from 'react';
import { css } from '@emotion/react';
import { useEuiTheme } from '@elastic/eui';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { DensityChart } from './density_chart';
import { HighlightedInterval } from './highlighted_interval';
import { SearchMarkers } from './search_markers';
Expand Down Expand Up @@ -58,11 +58,16 @@ export const LogMinimap = ({
summaryBuckets,
summaryHighlightBuckets,
width,
target,
target: initialTarget,
}: LogMinimapProps) => {
const [timeCursorY, setTimeCursorY] = useState<number>(0);
const [target, setTarget] = useState<number | null>(initialTarget);
const theme = useEuiTheme();

useEffect(() => {
setTarget(initialTarget);
}, [initialTarget]);

const handleClick: React.MouseEventHandler<SVGSVGElement> = (event) => {
const minimapTop = event.currentTarget.getBoundingClientRect().top;
const clickedYPosition = event.clientY - minimapTop;
Expand Down

0 comments on commit 5706db0

Please sign in to comment.