Skip to content

Commit 6e06e6c

Browse files
committed
fix(canvas): drop unused ResizeObserver in OverflowSpan
useFloatingTooltip's canShow already receives the hovered element, so measuring overflow via useIsOverflowing was redundant — every canvas row was paying for a ResizeObserver and resize listener it never used.
1 parent e3dc44f commit 6e06e6c

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

packages/workflow-renderer/src/lib/overflow-span.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FloatingTooltip, isTextClipped, useFloatingTooltip, useIsOverflowing } from '@sim/emcn'
1+
import { FloatingTooltip, isTextClipped, useFloatingTooltip } from '@sim/emcn'
22

33
interface OverflowSpanProps {
44
value: string
@@ -12,15 +12,11 @@ interface OverflowSpanProps {
1212
* with the full untruncated value (including raw code/JSON) over the graph.
1313
*/
1414
export function OverflowSpan({ value, className }: OverflowSpanProps) {
15-
const { ref, node } = useIsOverflowing<HTMLSpanElement>()
16-
const { state, handlers } = useFloatingTooltip(() => {
17-
const element = node.current
18-
return element !== null && isTextClipped(element)
19-
})
15+
const { state, handlers } = useFloatingTooltip(isTextClipped)
2016

2117
return (
2218
<>
23-
<span ref={ref} className={className} {...handlers}>
19+
<span className={className} {...handlers}>
2420
{value}
2521
</span>
2622
<FloatingTooltip label={value} state={state} />

0 commit comments

Comments
 (0)