diff --git a/plugins/tags-resources/src/components/TagsDropdownEditor.svelte b/plugins/tags-resources/src/components/TagsDropdownEditor.svelte index 0e375d487b0..d16a0b26c9a 100644 --- a/plugins/tags-resources/src/components/TagsDropdownEditor.svelte +++ b/plugins/tags-resources/src/components/TagsDropdownEditor.svelte @@ -67,9 +67,9 @@ if (result.action === 'add') { void addRef(result.tag) } else if (result.action === 'remove') { - const filtered = items.filter((it) => it.tag === result.tag._id) + const filtered = items.filter((it) => (it.tag ? it.tag === result.tag._id : it._id === result.tag._id)) if (filtered.length > 0) { - void removeTag(filtered[0]._id) + void removeTag(filtered[0].tag ?? filtered[0]._id) } } } @@ -82,7 +82,7 @@ ) } - async function removeTag (id: Ref): Promise { + async function removeTag (id: Ref | Ref): Promise { dispatch('delete', id) }