From 08be27a3234311a15d469afdd0747d14a82a9abc Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 3 Sep 2024 12:07:17 -0700 Subject: [PATCH 1/3] Fix whitespace --- src/util/treeJsonProcessing.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/treeJsonProcessing.js b/src/util/treeJsonProcessing.js index 2c29f6152..39e7fc91a 100644 --- a/src/util/treeJsonProcessing.js +++ b/src/util/treeJsonProcessing.js @@ -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) => { From c2125254e251ed1cda169d88128280389f46dccf Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 3 Sep 2024 12:05:48 -0700 Subject: [PATCH 2/3] Update `tree.nodeAttrKeys` during `ADD_EXTRA_METADATA` action Ensures that new metadata fields added to the tree are included as new tip labels. Fixes https://github.com/nextstrain/auspice/issues/1844 --- src/reducers/tree.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/reducers/tree.js b/src/reducers/tree.js index 9ce411cf8..6581364f3 100644 --- a/src/reducers/tree.js +++ b/src/reducers/tree.js @@ -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; } From 90006cfca05db584ca1c734a362e77a7b56eda2b Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 10 Sep 2024 11:19:11 -0700 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a72ead3..1be15ddfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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