Skip to content

Commit

Permalink
fix(react): fix tooltip performance issue (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
scurker authored Jan 12, 2022
1 parent 46e5429 commit 4fc5b1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react/src/components/Tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export default function Tooltip({
return () => {
targetElement.removeEventListener('keyup', handleEscape);
};
}, [show]);
}, [showProp]);

useEffect(() => {
if (typeof show !== undefined) {
if (typeof showProp !== undefined) {
targetElement?.addEventListener('mouseenter', handleTriggerMouseEnter);
targetElement?.addEventListener('mouseleave', handleTriggerMouseLeave);
targetElement?.addEventListener('focusin', show);
Expand All @@ -158,7 +158,7 @@ export default function Tooltip({
targetElement?.removeEventListener('focusin', show);
targetElement?.removeEventListener('focusout', hide);
};
}, [targetElement, show]);
}, [targetElement, showProp]);

useEffect(() => {
if (tooltipElement) {
Expand Down

0 comments on commit 4fc5b1a

Please sign in to comment.