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

This commit is contained in:
Roman Rizzi 2023-08-01 17:01:00 -03:00 committed by GitHub
parent da6ddb638f
commit 514f5d25e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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(