From 3da03340837dbf3ef2a6e179742420db71658d8c Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Wed, 25 Feb 2026 10:01:08 -0800 Subject: [PATCH] Fix enter selecting an option when there is no term. Closes #84 --- src/app/components/ClassifiedActions.svelte | 2 +- src/app/components/TopicMultiSelect.svelte | 8 ++++---- src/lib/components/Suggestions.svelte | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/components/ClassifiedActions.svelte b/src/app/components/ClassifiedActions.svelte index d01a0b8a..f034d945 100644 --- a/src/app/components/ClassifiedActions.svelte +++ b/src/app/components/ClassifiedActions.svelte @@ -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" diff --git a/src/app/components/TopicMultiSelect.svelte b/src/app/components/TopicMultiSelect.svelte index fa63339d..1f56ebd3 100644 --- a/src/app/components/TopicMultiSelect.svelte +++ b/src/app/components/TopicMultiSelect.svelte @@ -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 @@
-
+
{#each value as topic (topic)} -
+
diff --git a/src/lib/components/Suggestions.svelte b/src/lib/components/Suggestions.svelte index 0e39e153..db5bfc83 100644 --- a/src/lib/components/Suggestions.svelte +++ b/src/lib/components/Suggestions.svelte @@ -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) => {