Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Walk back up the hierarchy in locations

Uku Taht32f5a8d29675
diff --git a/assets/js/dashboard/stats/locations/index.js b/assets/js/dashboard/stats/locations/index.js
index d8a277ee6a..4f9fc621c7 100644
--- a/assets/js/dashboard/stats/locations/index.js
+++ b/assets/js/dashboard/stats/locations/index.js
@@ -96,6 +96,20 @@ export default class Locations extends React.Component {
}
}
+ componentDidUpdate(prevProps) {
+ const isRemovingFilter = (filterName) => {
+ return prevProps.query.filters[filterName] && !this.props.query.filters[filterName]
+ }
+
+ if (this.state.mode === 'cities' && isRemovingFilter('region')) {
+ this.setMode('regions')()
+ }
+
+ if (this.state.mode === 'regions' && isRemovingFilter('country')) {
+ this.setMode('countries')()
+ }
+ }
+
setMode(mode) {
return () => {
storage.setItem(this.tabKey, mode)