diff --git a/src/components/QueryResultTable/Cell/Cell.tsx b/src/components/QueryResultTable/Cell/Cell.tsx index 41b98dadc7..2df43422b2 100644 --- a/src/components/QueryResultTable/Cell/Cell.tsx +++ b/src/components/QueryResultTable/Cell/Cell.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import {hideTooltip, showTooltip} from '../../../store/reducers/tooltip'; +import {showTooltip} from '../../../store/reducers/tooltip'; import {useTypedDispatch} from '../../../utils/hooks'; import {b} from '../QueryResultTable'; @@ -14,13 +14,6 @@ export const Cell = React.memo(function Cell(props: CellProps) { const dispatch = useTypedDispatch(); - React.useEffect( - () => () => { - dispatch(hideTooltip()); - }, - [dispatch], - ); - return ( { + const {hideTooltip, toolTipVisible} = props; + if (toolTipVisible) { + setTimeout(() => hideTooltip(), 500); + } + }, [props]); + React.useEffect(() => { window.addEventListener('scroll', handleScroll, true); return () => { window.removeEventListener('scroll', handleScroll); }; - }, []); - - const handleScroll = () => { - const {hideTooltip, toolTipVisible} = props; - if (toolTipVisible) { - setTimeout(() => hideTooltip(), 500); - } - }; + }, [handleScroll]); const renderPositionPopup = (visible, positions, data, additionalData) => { const {template, popupClassName, hideTooltip} = props;