Skip to content

Commit

Permalink
[entropy] Fix out-of-sync entropy-events state
Browse files Browse the repository at this point in the history
Changing between "Entropy - Events" results in two dispatches
(`ENTROPY_COUNTS_TOGGLE` and `ENTROPY_DATA`) however the entropy code
would ignore the first update if it didn't contain new entropy data.
This bug has probably existed for the life of the entropy panel however
was masked by those two actions happening back-to-back and being
(always?) bundled together by redux.

Recent work in #1879 (v2.60.0) meant these actions were no longer
back-to-back and thus the bug was revealed.

Closes #1905
  • Loading branch information
jameshadfield committed Nov 17, 2024
1 parent 6e047d3 commit ca88ae8
Showing 1 changed file with 4 additions and 1 deletion.
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 ca88ae8

Please sign in to comment.