Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: colors of newly selected tags in tagselect

Ilian Sapundshiev1ddb31ec9464
diff --git a/src/renderer/components/TagsSelect.tsx b/src/renderer/components/TagsSelect.tsx
index 148a653b1..16cabc8f1 100644
--- a/src/renderer/components/TagsSelect.tsx
+++ b/src/renderer/components/TagsSelect.tsx
@@ -153,16 +153,16 @@ function TagsSelect(props: Props) {
const newTags = [];
tags.map((tag) => {
if (tagsValidation(tag)) {
- const newTag: TS.Tag = {
+ const existingTag = allTags.current.find(
+ (option) => option.title === tag,
+ );
+ const newTag: TS.Tag = existingTag ?? {
id: getUuid(),
title: '' + tag,
color: defaultBackgroundColor,
textcolor: defaultTextColor,
};
- //if (!allTags.current.find((option) => option.title === newTag.title)) {
newTags.push(newTag);
- //allTags.current.push(newTag);
- //}
} else {
tagsError.current = true;
forceUpdate();