feat(ui): move buttons to canvas for better performance#26268
feat(ui): move buttons to canvas for better performance#26268chirag-madlani merged 17 commits intomainfrom
Conversation
| zIndex: 1000, | ||
| }} | ||
| onMouseEnter={() => { | ||
| isOverPopoverRef.current = true; |
There was a problem hiding this comment.
⚠️ Bug: onMouseEnter guard prevents isOverPopoverRef from ever being set
The onMouseEnter handler on line 56 has a conditional if (isOverPopoverRef.current) that guards the assignment isOverPopoverRef.current = true. Since isOverPopoverRef is initialized to false (line 59 in CanvasEdgeRenderer.component.tsx), this condition will never pass on the first entry, meaning the ref stays false forever.
This breaks the popover hover-to-stay-open behavior: when the user moves their mouse from the canvas button into the popover, the 100ms timeout in handleMouseMove fires and calls setHoveredButtonRef.current?.(null), closing the popover before the user can interact with it. The isOverPopoverRef check that's supposed to prevent this (lines 117-121 of useCanvasMouseEvents.ts) never triggers because the ref is never set to true.
Suggested fix:
onMouseEnter={() => {
isOverPopoverRef.current = true;
if (hoverTimeoutRef.current) {
clearTimeout(hoverTimeoutRef.current);
hoverTimeoutRef.current = null;
}
}}
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
| // Path2D.isPointInStroke requires a CanvasRenderingContext2D to resolve | ||
| // the current lineWidth and transform, so we keep one around. | ||
| const canvasButtonsRef = useRef<CanvasButtonHitData[]>([]); | ||
| const hoveredButtonRef = useRef<CanvasButton | null>(null); |
There was a problem hiding this comment.
💡 Performance: hoveredButton state in draw deps causes full canvas redraw on hover
The hoveredButton state (via useState) is listed in the dependency array of the main draw/render callback (line 345 of useCanvasEdgeRenderer.ts). Every time the user hovers over or away from a button, hoveredButton changes, which triggers a full canvas redraw of all edges and buttons.
Consider using a ref for the hovered state and only redrawing the affected button area (or at minimum, debouncing the redraw) to avoid unnecessary full-canvas repaints on every mouse movement over buttons.
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
.../src/main/resources/ui/src/components/Entity/EntityLineage/CanvasButtonPopover.component.tsx
Show resolved
Hide resolved
🔍 CI failure analysis for 5364586: Current CI run (job 66083331587) shows no lineage-related failures; all failures are unrelated to this PR's changes. The previous PR-related `LineageSettings.spec.ts:284` pointer-events issue did not recur in this run.IssueCI failure in Current Run Failures (job 66083331587)No lineage, canvas, or pointer-events failures were detected. The failures are:
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|



This pull request introduces a new
CanvasButtonPopovercomponent to improve the user experience when interacting with pipeline buttons on lineage edges, and refactors the edge interaction logic to support this feature. It also removes the oldPipelineEdgeButtonscomponent and updates related styles and tests. The changes are grouped into three main themes: new feature implementation, refactoring and cleanup, and style improvements.New Feature: CanvasButtonPopover
CanvasButtonPopovercomponent that displays detailed information about a pipeline when a user hovers over a pipeline button on a lineage edge. This popover includes the pipeline's fully qualified name, type, and status, and is positioned absolutely based on the viewport. [1] [2]CanvasButtonPopover, covering rendering, props, mouse interactions, and status color display.Refactoring and Cleanup
CanvasEdgeRenderer.component.tsxto integrate the new popover:useCanvasMouseEventshook.PipelineEdgeButtonscomponent and its references, simplifying the rendering logic. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]getAbsolutePositionto use a shared utility, ensuring consistency across components. [1] [2]useCanvasEdgeRendererhook to expose new button-related methods and state for use in the renderer.Style Improvements
StyledIconButtoncomponent by increasing the padding and standardizing icon size for better visual consistency.These changes collectively modernize the edge interaction experience, improve code maintainability, and lay the groundwork for further enhancements to lineage visualization.
Describe your changes:
Fixes
I worked on ... because ...
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>