Skip to content

Commit

Permalink
fix: don't allow to select same tag multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Jan 7, 2024
1 parent e09a5b0 commit 816f7f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/utils/TagList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
$: allTags =
$getAllTags.data?.getTags?.map((t) => ({
label: `${t.name} - ${t.description}`,
value: t.id
value: t.id,
name: t.name
})) || ([] satisfies AutocompleteOption[]);
const popupSettings: PopupSettings = {
Expand Down Expand Up @@ -85,7 +86,7 @@
<div class="card max-h-48 w-max max-w-full overflow-y-auto p-4" tabindex="-1" data-popup="popupAutocomplete">
<Autocomplete
bind:input={inputTag}
options={allTags.filter((t) => tagList.indexOf(t.label) < 0)}
options={allTags.filter((t) => tagList.indexOf(t.name) < 0)}
on:selection={(t) => addTag(t.detail)} />
</div>
{/if}
Expand Down

0 comments on commit 816f7f3

Please sign in to comment.