diff --git a/desktop/plugins/public/ui-debugger/components/Tree.tsx b/desktop/plugins/public/ui-debugger/components/Tree.tsx index 23c16ceb4..23d2beeb3 100644 --- a/desktop/plugins/public/ui-debugger/components/Tree.tsx +++ b/desktop/plugins/public/ui-debugger/components/Tree.tsx @@ -108,7 +108,9 @@ export function Tree(props: { }, onMouseOver: () => { - instance.hoveredNodes.set([item.index]); + if (!instance.isContextMenuOpen.get()) { + instance.hoveredNodes.set([item.index]); + } }, }), }}> @@ -201,12 +203,16 @@ const ContextMenu: React.FC = ({id, title, children}) => { return ( { + instance.isContextMenuOpen.set(visible); + }} overlay={() => ( {focusedNode !== head(instance.hoveredNodes.get()) && ( { instance.focusedNode.set(id); + instance.isContextMenuOpen.set(false); }}> Focus {title} @@ -216,6 +222,7 @@ const ContextMenu: React.FC = ({id, title, children}) => { { instance.focusedNode.set(undefined); + instance.isContextMenuOpen.set(false); }}> Remove focus diff --git a/desktop/plugins/public/ui-debugger/index.tsx b/desktop/plugins/public/ui-debugger/index.tsx index 9f6fa540b..5bb3e345f 100644 --- a/desktop/plugins/public/ui-debugger/index.tsx +++ b/desktop/plugins/public/ui-debugger/index.tsx @@ -48,6 +48,9 @@ export function plugin(client: PluginClient) { perfEvents.append(event); }); + //used to disabled hover effects which cause rerenders and mess up the existing context menu + const isContextMenuOpen = createState(false); + const focusedNode = createState(undefined); const nodes = createState>(new Map()); @@ -108,6 +111,7 @@ export function plugin(client: PluginClient) { return { rootId, + isContextMenuOpen, nodes, metadata, focusedNode,