Skip to content

Commit

Permalink
Merge pull request #28151 from BeeMargarida/fix/26793-disabled-tags-e…
Browse files Browse the repository at this point in the history
…dit-tag-issue

#26793: show selected tag even if all are disabled
  • Loading branch information
amyevans authored Sep 28, 2023
2 parents e1ba6aa + 7cf7314 commit 87e6a80
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,24 @@ function getTagListSections(tags, recentlyUsedTags, selectedOptions, searchInput
const numberOfTags = _.size(enabledTags);
let indexOffset = 0;

// If all tags are disabled but there's a previously selected tag, show only the selected tag
if (numberOfTags === 0 && selectedOptions.length > 0) {
const selectedTagOptions = _.map(selectedOptions, (option) => ({
name: option.name,
// Should be marked as enabled to be able to be de-selected
enabled: true,
}));
tagSections.push({
// "Selected" section
title: '',
shouldShow: false,
indexOffset,
data: getTagsOptions(selectedTagOptions),
});

return tagSections;
}

if (!_.isEmpty(searchInputValue)) {
const searchTags = _.filter(enabledTags, (tag) => tag.name.toLowerCase().includes(searchInputValue.toLowerCase()));

Expand Down

0 comments on commit 87e6a80

Please sign in to comment.