Logs Panel: Only send DataHoverClearEvent on container mouse leave event (#92526)

* fix: stop sending clear events between every row, and only when the mouse leaves the container
This commit is contained in:
Galen Kistler
2024-08-27 22:44:17 +03:00
committed by GitHub
parent 931d64b8fc
commit 867f3f793c
2 changed files with 6 additions and 7 deletions
@@ -149,9 +149,6 @@ class UnThemedLogRow extends PureComponent<Props, State> {
onMouseLeave = () => {
this.setState({ mouseIsOver: false });
if (this.props.onLogRowHover) {
this.props.onLogRowHover(undefined);
}
};
componentDidMount() {
+6 -4
View File
@@ -114,9 +114,7 @@ export const LogsPanel = ({
const { eventBus, onAddAdHocFilter } = usePanelContext();
const onLogRowHover = useCallback(
(row?: LogRowModel) => {
if (!row) {
eventBus.publish(new DataHoverClearEvent());
} else {
if (row) {
eventBus.publish(
new DataHoverEvent({
point: {
@@ -129,6 +127,10 @@ export const LogsPanel = ({
[eventBus]
);
const onLogContainerMouseLeave = useCallback(() => {
eventBus.publish(new DataHoverClearEvent());
}, [eventBus]);
const onCloseContext = useCallback(() => {
setContextRow(null);
if (closeCallback.current) {
@@ -350,7 +352,7 @@ export const LogsPanel = ({
scrollTop={scrollTop}
scrollRefCallback={(scrollElement) => setScrollElement(scrollElement)}
>
<div className={style.container} ref={logsContainerRef}>
<div onMouseLeave={onLogContainerMouseLeave} className={style.container} ref={logsContainerRef}>
{showCommonLabels && !isAscending && renderCommonLabels()}
<LogRows
containerRendered={logsContainerRef.current !== null}