Skip to content

Commit

Permalink
Merge pull request #2751 from okauppinen/statgrid-fixes
Browse files Browse the repository at this point in the history
Statgrid fixes
  • Loading branch information
ZakarFin authored Nov 27, 2024
2 parents 6ff8b36 + 026e9c6 commit 1e1025e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bundles/statistics/statsgrid/components/RegionsetViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Oskari.clazz.define('Oskari.statistics.statsgrid.RegionsetViewer', function (ins
}
this._lastRenderCache.highlightRegionId = activeRegion;
},
flushLastRenderStateCache: function () {
this._lastRenderStateForSelectedRegionOptimizing = {};
},
isOnlyActiveRegionChange: function (state = {}) {
const sameRegionset = this._lastRenderStateForSelectedRegionOptimizing.regionset === state.regionset;
const sameIndicator = this._lastRenderStateForSelectedRegionOptimizing.activeIndicator === state.activeIndicator;
Expand Down
4 changes: 3 additions & 1 deletion bundles/statistics/statsgrid/handler/StatisticsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class StatisticsController extends AsyncStateHandler {
}
this.updateState({ loading: true });
try {
this.instance.regionsetViewer?.flushLastRenderStateCache();
let active;
const indicatorsToAdd = [];
// async/await doesn't work with forEach()
Expand All @@ -206,14 +207,15 @@ class StatisticsController extends AsyncStateHandler {
}
};
const isSeriesActive = active ? !!active.series : false;
this.updateState({ activeIndicator, isSeriesActive, activeRegion, regionset, indicators: indicatorsToAdd, loading: false });
this.updateState({ activeIndicator, isSeriesActive, activeRegion, regionset, indicators: indicatorsToAdd });
// reset active
if (!active) {
this.setActiveIndicator();
}
} catch (error) {
this.log.warn('Failed to set stored state', error.message);
}
this.updateState({ loading: false });
}

async onCacheUpdate (indicator, onlyData) {
Expand Down
2 changes: 1 addition & 1 deletion bundles/statistics/statsgrid/view/Form/ClipboardPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ClipboardPopup.propTypes = {
};

export const showClipboardPopup = (controller, onClose) => {
const title = <Message messageKey='userIndicators.flyoutTitle' bundleKey={BUNDLE_KEY} />;
const title = <Message messageKey='userIndicators.import.title' bundleKey={BUNDLE_KEY} />;
return showPopup(
title,
<LocaleProvider value={{ bundleKey: BUNDLE_KEY }}>
Expand Down

0 comments on commit 1e1025e

Please sign in to comment.