Skip to content

Commit

Permalink
Slightly improve type safteyness
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Roes committed Jun 23, 2021
1 parent 279b72d commit 7223bc5
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,17 @@ export const DiscoverFieldVisualize: React.FC<Props> = React.memo(
);
}, [details.columns, field, indexPattern, multiFields]);

if (!visualizeInfo) {
return null;
}

const handleVisualizeLinkClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
if (!visualizeInfo) {
return;
}
// regular link click. let the uiActions code handle the navigation and show popup if needed
event.preventDefault();
trackUiMetric?.(METRIC_TYPE.CLICK, 'visualize_link_click');
triggerVisualizeActions(visualizeInfo.field, indexPattern.id, details.columns);
};

if (!visualizeInfo) {
return null;
}

return (
<EuiPopoverFooter>
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
Expand Down

0 comments on commit 7223bc5

Please sign in to comment.