fix: close dropdown after creating a tag

This commit is contained in:
Antonella Sgarlatta
2021-06-01 21:02:52 -03:00
parent 684a3fb0bf
commit 53a55d4bc7

View File

@@ -43,7 +43,7 @@ export const AutocompleteTagInput: FunctionalComponent<Props> = ({
setTagResults(getActiveNoteTagResults(''));
};
const [closeOnBlur, setLockCloseOnBlur] = useCloseOnBlur(
const [closeOnBlur] = useCloseOnBlur(
dropdownRef,
(visible: boolean) => {
setDropdownVisible(visible);
@@ -65,18 +65,14 @@ export const AutocompleteTagInput: FunctionalComponent<Props> = ({
};
const onTagOptionClick = async (tag: SNTag) => {
setLockCloseOnBlur(true);
await appState.activeNote.addTagToActiveNote(tag);
inputRef.current.focus();
setTagResults(getActiveNoteTagResults(searchQuery));
setLockCloseOnBlur(false);
clearResults();
};
const createAndAddNewTag = async () => {
const newTag = await application.findOrCreateTag(searchQuery);
await appState.activeNote.addTagToActiveNote(newTag);
clearResults();
inputRef.current.focus();
};
const onTagHintClick = async () => {