Fix enter selecting an option when there is no term. Closes #84

This commit is contained in:
Jon Staab
2026-02-25 10:01:08 -08:00
parent c970038943
commit 3da0334083
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
import {getTagValue, getTagValues, getAddress} from "@welshman/util"
import {pubkey} from "@welshman/app"
import Pen2 from "@assets/icons/pen-2.svg?dataurl"
import {normalizeTopic} from '@lib/util'
import {normalizeTopic} from "@lib/util"
import Link from "@lib/components/Link.svelte"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
+4 -4
View File
@@ -2,7 +2,7 @@
import {writable} from "svelte/store"
import type {Writable} from "svelte/store"
import type {Instance} from "tippy.js"
import {remove, without, uniq} from "@welshman/lib"
import {remove, reject, spec, uniq} from "@welshman/lib"
import {createSearch, topics} from "@welshman/app"
import {normalizeTopic} from "@lib/util"
import Suggestions from "@lib/components/Suggestions.svelte"
@@ -21,7 +21,7 @@
let {value = $bindable(), term = writable("")}: Props = $props()
const topicSearch = $derived.by(() =>
createSearch(without(value, $topics), {
createSearch(reject(spec({name: value}), $topics), {
getValue: topic => topic.name,
fuseOptions: {
keys: ["name"],
@@ -76,9 +76,9 @@
</script>
<div class="flex flex-col gap-2">
<div class="flex flex-wrap gap-2">
<div>
{#each value as topic (topic)}
<div class="badge badge-neutral gap-1">
<div class="flex-inline badge badge-neutral mr-1 gap-1">
<Button class="flex items-center" onclick={() => removeTopic(topic)}>
<Icon icon={CloseCircle} size={4} class="-ml-1 mt-px" />
</Button>
+1 -1
View File
@@ -9,7 +9,7 @@
let items: string[] = $state([])
const populateItems = throttle(300, term => {
items = search(term).slice(0, 5)
items = term ? search(term).slice(0, 5) : []
})
const setIndex = (newIndex: number, block: any) => {