Skip to content

A platform for community discussion. Free, open, simple.

FIX: Default to the first list if the preferred one is empty (#22915)

Roman Rizzi514f5d25e649
diff --git a/app/assets/javascripts/discourse/app/components/more-topics.js b/app/assets/javascripts/discourse/app/components/more-topics.js
index 16e26b485ee..6d676bb59b4 100644
--- a/app/assets/javascripts/discourse/app/components/more-topics.js
+++ b/app/assets/javascripts/discourse/app/components/more-topics.js
@@ -41,8 +41,11 @@ export default class MoreTopics extends Component {
}
let preference = this.moreTopicsPreferenceTracking.preference;
+ // Scenario where we have a preference, but there
+ // are no more elements in it.
+ const listPresent = pills.find((pill) => pill.id === preference);
- if (!preference) {
+ if (!listPresent) {
const rememberPref = this.site.mobileView && !this.singleList;
this.moreTopicsPreferenceTracking.updatePreference(