Skip to content

Commit a95b142

Browse files
committed
create variable
1 parent b0cc830 commit a95b142

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/components/Tooltip/EducationalTooltip/BaseEducationalTooltip.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
3232

3333
const isResizing = useIsResizing();
3434

35+
const shouldHideOnBlur = !isFocused && shouldHideOnNavigate;
36+
3537
const renderTooltip = useCallback(() => {
36-
if (!tooltipElementRef.current || !genericTooltipStateRef.current || (!isFocused && shouldHideOnNavigate)) {
38+
if (!tooltipElementRef.current || !genericTooltipStateRef.current || shouldHideOnBlur) {
3739
return;
3840
}
3941

@@ -66,7 +68,7 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
6668
showTooltip();
6769
}
6870
});
69-
}, [insets, isFocused, shouldHideOnNavigate]);
71+
}, [insets, shouldHideOnBlur]);
7072

7173
useEffect(() => {
7274
if (!genericTooltipStateRef.current || !shouldRender) {
@@ -121,7 +123,7 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
121123
}, []);
122124

123125
useEffect(() => {
124-
if (!shouldMeasure || (!isFocused && shouldHideOnNavigate)) {
126+
if (!shouldMeasure || shouldHideOnBlur) {
125127
return;
126128
}
127129
if (!shouldRender) {
@@ -135,7 +137,7 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
135137
return () => {
136138
clearTimeout(timerID);
137139
};
138-
}, [shouldMeasure, shouldRender, isFocused, shouldHideOnNavigate]);
140+
}, [shouldMeasure, shouldRender, shouldHideOnBlur]);
139141

140142
useEffect(() => {
141143
if (!navigator) {

0 commit comments

Comments
 (0)