don't backfill tags, close dropdown on tab

This commit is contained in:
Eric Bailey
2023-10-19 16:45:22 -04:00
parent 2d62a4942a
commit d93587aeef
2 changed files with 2 additions and 5 deletions
+1 -5
View File
@@ -4,10 +4,6 @@ import {RootStoreModel} from '../root-store'
import Fuse from 'fuse.js'
import {isObj, hasProp, isStrArray} from 'lib/type-guards'
function uniq(arr: string[]) {
return Array.from(new Set(arr))
}
/**
* Used only to persist recent tags across app restarts.
*
@@ -100,7 +96,7 @@ export class TagsAutocompleteModel {
// search amongst mixed set of tags
const results = fuse.search(this.query).map(r => r.item)
// backfill again in case search has no results
return uniq([...results, ...items]).slice(0, 9)
return results.slice(0, 9)
}
async search(query: string) {
@@ -120,6 +120,7 @@ export function TagInput({
if (key === 'Backspace' && value === '') {
addTags(tags.slice(0, -1))
closeDropdownAndReset()
} else if (key === ' ') {
e.preventDefault() // prevents an additional space on web
addTagAndReset(value)