Skip to content

Commit e51fae6

Browse files
Fix extendedTooltip not shown when defined for a react flow handle
1 parent 3ee540a commit e51fae6

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2323

2424
- `<MultiSelect />`
2525
- border of the BlueprintJS `Tag` elements were fixed
26+
- `extendedTooltip` of a handle in the ReactFlow (v12) component does not show the tooltip.
2627

2728
### Changed
2829

src/extensions/react-flow/handles/HandleDefault.tsx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,15 @@ export const HandleDefault = memo(
8989
isOpen: extendedTooltipDisplayed,
9090
};
9191

92-
const handleContentProps = React.useMemo(
93-
() => ({
94-
...data,
95-
tooltipProps: {
96-
...handleContentTooltipProps,
97-
...data?.tooltipProps,
98-
} as TooltipProps,
99-
}),
100-
[intent, category, handleProps.isConnectable],
101-
);
92+
const handleContentProps = {
93+
...data,
94+
tooltipProps: {
95+
...handleContentTooltipProps,
96+
...data?.tooltipProps,
97+
} as TooltipProps,
98+
};
10299

103-
const handleContent = React.useMemo(
104-
() => <HandleContent {...handleContentProps}>{children}</HandleContent>,
105-
[],
106-
);
100+
const handleContent = <HandleContent {...handleContentProps}>{children}</HandleContent>;
107101

108102
let switchTooltipTimerOn: ReturnType<typeof setTimeout>;
109103
let switchToolsTimerOff: ReturnType<typeof setTimeout>;
@@ -119,15 +113,15 @@ export const HandleDefault = memo(
119113
if (handleProps.onClick) {
120114
handleProps.onClick(e);
121115
}
122-
if (toolsTarget.length > 0 && e.target === handleDefaultRef.current) {
116+
if (toolsTarget.length > 0 && e.currentTarget === handleDefaultRef.current) {
123117
setExtendedTooltipDisplayed(false);
124118
(toolsTarget[0] as HTMLElement).click();
125119
}
126120
},
127121
"data-category": category,
128122
onMouseEnter: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
129123
if (switchToolsTimerOff) clearTimeout(switchToolsTimerOff);
130-
if (e.target === handleDefaultRef.current) {
124+
if (e.currentTarget === handleDefaultRef.current) {
131125
switchTooltipTimerOn = setTimeout(
132126
() => setExtendedTooltipDisplayed(true),
133127
data?.tooltipProps?.hoverOpenDelay ?? 500,
@@ -142,7 +136,16 @@ export const HandleDefault = memo(
142136
setExtendedTooltipDisplayed(false);
143137
},
144138
}),
145-
[intent, category, tooltip, handleProps.isConnectable, handleProps.style],
139+
[
140+
intent,
141+
category,
142+
tooltip,
143+
flowVersionCheck,
144+
handleProps.isConnectable,
145+
handleProps.style,
146+
handleProps.onClick,
147+
data?.tooltipProps?.hoverOpenDelay,
148+
],
146149
);
147150

148151
switch (flowVersionCheck) {

0 commit comments

Comments
 (0)