Skip to content

Commit

Permalink
fix: disabled tag is not displayed in the list as selected
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed Feb 21, 2024
1 parent 6989089 commit 1cab9fd
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ function getTagsOptions(tags: Category[]): Option[] {
function getTagListSections(tags: Tag[], recentlyUsedTags: string[], selectedOptions: Category[], searchInputValue: string, maxRecentReportsToShow: number) {
const tagSections = [];
const sortedTags = sortTags(tags);
const enabledTags = sortedTags.filter((tag) => tag.enabled);
const enabledTags = [...selectedOptions, ...sortedTags.filter((tag) => tag.enabled)];
const numberOfTags = enabledTags.length;
let indexOffset = 0;

Expand Down Expand Up @@ -1119,13 +1119,10 @@ function getTagListSections(tags: Tag[], recentlyUsedTags: string[], selectedOpt
const filteredTags = enabledTags.filter((tag) => !selectedOptionNames.includes(tag.name));

if (selectedOptions.length) {
const selectedTagOptions = selectedOptions.map((option) => {
const tagObject = tags.find((tag) => tag.name === option.name);
return {
name: option.name,
enabled: !!tagObject?.enabled,
};
});
const selectedTagOptions = selectedOptions.map((option) => ({
name: option.name,
enabled: true,
}));

tagSections.push({
// "Selected" section
Expand Down

0 comments on commit 1cab9fd

Please sign in to comment.