mirror of
https://github.com/D4M13N-D3V/neroshitron.git
synced 2025-03-14 10:05:04 +00:00
fix: adding duplicates
This commit is contained in:
parent
e9e4f25520
commit
fd76220269
@ -73,14 +73,14 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnable
|
||||
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
||||
const newIndex = currentIndex === tags.length - 1 ? 0 : currentIndex + 1;
|
||||
setCurrentTag(tags[newIndex].name);
|
||||
}
|
||||
else if(event.key === 'Enter'){
|
||||
} else if (event.key === 'Enter') {
|
||||
const currentIndex = tags.findIndex(tag => tag.name === currentTag);
|
||||
if (currentIndex !== -1 && !selectedTags.includes(tags[currentIndex].name)) {
|
||||
setSelectedTags([...selectedTags, tags[currentIndex].name]);
|
||||
const tagsInput = selectedTagsInput;
|
||||
tagsInput.push({ value: tags[currentIndex].name, label: tags[currentIndex].name });
|
||||
setSelectedTagsInput(tagsInput);
|
||||
setCurrentTag('');
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -130,6 +130,13 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnable
|
||||
setSelectedTags([value.value]);
|
||||
setSelectedTagsInput([value])
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
setSelectedTags(value.map((option) => option.value));
|
||||
setSelectedTagsInput(value.filter((option) => option.value !== 'placeholder'));
|
||||
} else if (value) {
|
||||
setSelectedTags([value.value]);
|
||||
setSelectedTagsInput([value]);
|
||||
}
|
||||
}}
|
||||
onSearchInputChange={(value) => {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user