Skip to content

Commit

Permalink
Merge pull request #1906 from nextstrain/james/entropy-fixes
Browse files Browse the repository at this point in the history
Entropy bug fixes
  • Loading branch information
jameshadfield authored Nov 18, 2024
2 parents 522c21d + 117deb2 commit 7ec0222
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/actions/entropy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const updateEntropyVisibility = debounce((dispatch, getState) => {

const [data, maxYVal] = calcEntropyInView(tree.nodes, tree.visibility, entropy.selectedCds, entropy.showCounts);
dispatch({type: types.ENTROPY_DATA, data, maxYVal});
}, 500, { leading: false, trailing: true });
}, 500, { leading: true, trailing: true });

/**
* Returns a thunk which makes zero or one dispatches to update the entropy reducer
Expand Down
5 changes: 4 additions & 1 deletion src/components/entropy/entropyD3.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ EntropyChart.prototype.update = function update({
this._setZoomBounds();
}

if (showCounts!==undefined) this.showCounts = showCounts;

if (newBars || selectedPositions!==undefined) {
if (showCounts!==undefined) this.showCounts = showCounts;
if (newBars) {
this.bars = newBars[0];
this._updateOffsets();
Expand All @@ -75,6 +76,8 @@ EntropyChart.prototype.update = function update({
if (selectedPositions !== undefined) {
this.selectedPositions = selectedPositions;
}
/* TODO XXX: there's a potential bug here if selectedCds is set but we don't enter this code block
due to the (newBars || selectedPositions!==undefined) conditional */
if (selectedCds || selectedPositions !== undefined) {
this._setZoomCoordinates(zoomMin, zoomMax, !!selectedCds);
}
Expand Down

0 comments on commit 7ec0222

Please sign in to comment.