mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-25 17:12:16 +00:00
FIX: unable to click doughnut when no filters (#1213)
This PR fixes an issue where you are unable to click to see the sentiment drill-down when there are no current filters applied. This is due to trying to `JSON.parse()` the filters when there are no filters. This fix ensures there are filters first before trying to parse the JSON.
This commit is contained in:
parent
2dd7068b46
commit
50e1bc774a
@ -216,10 +216,15 @@ export default class AdminReportSentimentAnalysis extends Component {
|
||||
}
|
||||
|
||||
const currentQueryParams = this.router.currentRoute.queryParams;
|
||||
|
||||
const currentFilters = currentQueryParams?.filters
|
||||
? JSON.parse(currentQueryParams.filters)
|
||||
: {};
|
||||
|
||||
this.router.transitionTo(this.router.currentRoute.name, {
|
||||
queryParams: {
|
||||
...currentQueryParams,
|
||||
filters: JSON.parse(currentQueryParams.filters), // avoids a double escaping
|
||||
filters: currentFilters, // avoids a double escaping
|
||||
selectedChart: data.title,
|
||||
},
|
||||
});
|
||||
@ -265,10 +270,13 @@ export default class AdminReportSentimentAnalysis extends Component {
|
||||
this.posts = [];
|
||||
|
||||
const currentQueryParams = this.router.currentRoute.queryParams;
|
||||
const currentFilters = currentQueryParams?.filters
|
||||
? JSON.parse(currentQueryParams.filters)
|
||||
: {};
|
||||
this.router.transitionTo(this.router.currentRoute.name, {
|
||||
queryParams: {
|
||||
...currentQueryParams,
|
||||
filters: JSON.parse(currentQueryParams.filters), // avoids a double escaping
|
||||
filters: currentFilters, // avoids a double escaping
|
||||
selectedChart: null,
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user