From ca88ae8da5eaa4ef9c21bebd18f724fbfca45a06 Mon Sep 17 00:00:00 2001 From: james hadfield Date: Mon, 18 Nov 2024 11:11:25 +1300 Subject: [PATCH] [entropy] Fix out-of-sync entropy-events state 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 --- src/components/entropy/entropyD3.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/entropy/entropyD3.js b/src/components/entropy/entropyD3.js index 2cc3f7f35..9edd6c275 100644 --- a/src/components/entropy/entropyD3.js +++ b/src/components/entropy/entropyD3.js @@ -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(); @@ -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); }