Skip to content

Commit

Permalink
Fix invisible selector when it doesn't have any annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Feb 27, 2024
1 parent ff5b156 commit 5cdb155
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/common/components/sidebar/annotations-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,27 @@ const AnnotationsView = memo(React.forwardRef((props, ref) => {
}
}

// If filter has tags, colors or authors that no longer exist in any annotation,
// add them directly from filter to selector to avoid state when selector doesn't show
// anything and annotations list is empty
for (let tag of props.filter.tags) {
if (!tags[tag]) {
tags[tag] = { name: tag, selected: true, inactive: false };
}
}

for (let color of props.filter.colors) {
if (!colors[color]) {
colors[color] = { color, selected: true, inactive: false, name: null };
}
}

for (let author of props.filter.authors) {
if (!authors[author]) {
authors[author] = { author, selected: true, inactive: false, current: author === props.authorName };
}
}

for (let annotation of filteredAnnotations) {
for (let tag of annotation.tags) {
tags[tag.name].inactive = false;
Expand Down

0 comments on commit 5cdb155

Please sign in to comment.