fix: ensure exact tag matching with enter key behavior refinement (#7387)

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
KushalSharmaGit
2024-07-01 07:46:16 +05:30
committed by GitHub
parent 824be0d4c1
commit d72dbe682c
2 changed files with 16 additions and 3 deletions
@@ -197,7 +197,8 @@ export const TagsEditor = ({ pageId, readonly }: TagsEditorProps) => {
[setOpen, setSelectedTagIds]
);
const exactMatch = useLiveData(tagList.tagByTagValue$(inputValue));
const match = useLiveData(tagList.tagByTagValue$(inputValue));
const exactMatch = useLiveData(tagList.excactTagByValue$(inputValue));
const filteredTags = useLiveData(
inputValue ? tagList.filterTagsByName$(inputValue) : tagList.tags$
@@ -266,7 +267,7 @@ export const TagsEditor = ({ pageId, readonly }: TagsEditorProps) => {
tags.find(tag => tag.id === lastTagId)?.untag(pageId);
}
},
[exactMatch, inputValue, onAddTag, onCreateTag, pageId, tagIds, tags]
[inputValue, tagIds, exactMatch, onAddTag, onCreateTag, tags, pageId]
);
return (
@@ -320,7 +321,7 @@ export const TagsEditor = ({ pageId, readonly }: TagsEditorProps) => {
</div>
);
})}
{exactMatch || !inputValue ? null : (
{match || !inputValue ? null : (
<div
data-testid="tag-selector-item"
className={styles.tagSelectorItem}