From 62076305699271f4ddf62a231d58511746b9c24c Mon Sep 17 00:00:00 2001 From: james hadfield Date: Wed, 21 Feb 2024 11:32:05 +1300 Subject: [PATCH] Fix missing mutations on terminal branch hover Hovering on terminal branches incorrectly displayed tip-specific information rather than branch-specific. This bug was introduced in 86b85273e4f5df94e4b6191efb2781bb614f032c and this commit reverts some of the changes introduced there. Closes --- CHANGELOG.md | 4 ++-- src/components/tree/infoPanels/hover.js | 5 +++-- src/components/tree/reactD3Interface/callbacks.js | 8 ++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16ac87231..f4e78d995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog -## version 2.52.0 - 2024/02/09 - +* Bugfix: hovering on terminal branches now shows branch-specific rather than tip-specific information (bug introduced in 2.52.0). See [issue #1752](https://github.com/nextstrain/auspice/issues/1752) for more. +## version 2.52.0 - 2024/02/09 * Sidebar filtering now contains all non-continuous metadata defined across the tree (i.e. all data within `node.node_attrs`). The traits listed in `meta.filters` are now only used to determine which filters to list in the footer of the page. ([#1743](https://github.com/nextstrain/auspice/pull/1743)) * The interaction between strain-selected modals and the corresponding strain-filter has been improved. We now preserve the strain filter state present before the node was clicked. ([#1749](https://github.com/nextstrain/auspice/issues/1749)) diff --git a/src/components/tree/infoPanels/hover.js b/src/components/tree/infoPanels/hover.js index 393c36bbc..1812bea7c 100644 --- a/src/components/tree/infoPanels/hover.js +++ b/src/components/tree/infoPanels/hover.js @@ -402,11 +402,12 @@ const HoverInfoPanel = ({ t }) => { if (!selectedNode) return null - const node = selectedNode.n; + const node = selectedNode.node.n; // want the redux node, not the phylo node const idxOfInViewRootNode = getIdxOfInViewRootNode(node); + return ( - {node.hasChildren===false ? ( + {selectedNode.isBranch===false ? ( <> diff --git a/src/components/tree/reactD3Interface/callbacks.js b/src/components/tree/reactD3Interface/callbacks.js index dbd13f7d0..00d51fbec 100644 --- a/src/components/tree/reactD3Interface/callbacks.js +++ b/src/components/tree/reactD3Interface/callbacks.js @@ -13,7 +13,9 @@ export const onTipHover = function onTipHover(d) { this.state.treeToo; phylotree.svg.select("#"+getDomId("tip", d.n.name)) .attr("r", (e) => e["r"] + 4); - this.setState({hoveredNode: d}); + this.setState({ + hoveredNode: {node: d, isBranch: false} + }); }; export const onTipClick = function onTipClick(d) { @@ -46,7 +48,9 @@ export const onBranchHover = function onBranchHover(d) { } /* Set the hovered state so that an info box can be displayed */ - this.setState({hoveredNode: d}); + this.setState({ + hoveredNode: {node: d, isBranch: true} + }); }; export const onBranchClick = function onBranchClick(d) {