Skip to content

Commit 1865100

Browse files
committed
fix(graph-view): keep canvas host mounted when hover label toggles
Render HoverNode after the force-graph container so index-based reconciliation does not remount the host and wipe the graph.
1 parent e15dfcc commit 1865100

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎plugins/sanity-plugin-graph-view/src/tool/GraphView.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,13 @@ export default function GraphView({
561561
</LegendRow>
562562
))}
563563
</Legend>
564-
{hoverNode && <HoverNode theme={theme}>{labelFor(hoverNode.doc)}</HoverNode>}
565564
<div
566565
ref={(element) => {
567566
if (element) setContainer(element)
568567
}}
569568
/>
569+
{/* After the canvas host so toggling hover does not remount it (index reconciliation). */}
570+
{hoverNode && <HoverNode theme={theme}>{labelFor(hoverNode.doc)}</HoverNode>}
570571
</GraphRoot>
571572
</GraphWrapper>
572573
)

0 commit comments

Comments
 (0)