Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new metadata tip label #1845

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

* Fix bug where drag-and-drop metadata columns were no longer included as tip labels ([#1845](https://github.com/nextstrain/auspice/pull/1845))

## version 2.57.0 - 2024/08/30


Expand Down
9 changes: 7 additions & 2 deletions src/reducers/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,22 @@ const Tree = (state = getDefaultTreeState(), action) => {
});
case types.TREE_TOO_DATA:
return action.tree;
case types.ADD_EXTRA_METADATA:
case types.ADD_EXTRA_METADATA: {
// add data into `nodes` in-place, so no redux update will be triggered if you only listen to `nodes`
addNodeAttrs(state.nodes, action.newNodeAttrs);
// add the new nodeAttrKeys to ensure tip labels get updated
const nodeAttrKeys = new Set(state.nodeAttrKeys);
Object.keys(action.newColorings).forEach((attr) => nodeAttrKeys.add(attr));
// add the new colorings to totalStateCounts so that they can function as filters
return {
...state,
totalStateCounts: {
...state.totalStateCounts,
...countTraitsAcrossTree(state.nodes, Object.keys(action.newColorings), false, true)
}
},
nodeAttrKeys
};
}
default:
return state;
}
Expand Down
4 changes: 2 additions & 2 deletions src/util/treeJsonProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const pseudoRandomName = () => (Math.random()*1e32).toString(36).slice(0, 6);
* node.hasChildren {bool}
* node.arrayIdx {integer} - the index of the node in the nodes array
* @param {array} nodes redux tree nodes
* @return {Object} ret
* @return {Object} ret
* @return {Set} ret.nodeAttrKeys collection of all `node_attr` keys whose values are Objects
* @return {Array} ret.nodes input array (kinda unnecessary)
*
*
* side-effects: node.hasChildren (bool) and node.arrayIdx (INT) for each node in nodes
*/
const processNodes = (nodes) => {
Expand Down