Prevent adding duplicate stash triggers to alert.

This commit is contained in:
DebaucheryLibrarian 2024-05-28 06:01:28 +02:00
parent f48afaeffa
commit 419a0c9362
1 changed files with 34 additions and 30 deletions

View File

@ -329,6 +329,7 @@
/>
</li>
<template v-if="stashes.length < user.stashes.length">
<li class="field-add">
<button
v-if="stashes.length === 0"
@ -348,7 +349,7 @@
<template #popper>
<ul class="nolist">
<li
v-for="stash in user.stashes"
v-for="stash in user.stashes.filter((stash) => !stashes.some((selectedStash) => selectedStash.id === stash.id))"
:key="`stash-result-${stash.id}`"
v-close-popper
class="result-item result-stash result-label"
@ -360,6 +361,7 @@
</template>
</VDropdown>
</li>
</template>
</ul>
</div>
</div>
@ -497,8 +499,10 @@ function addMatch() {
matchExpression.value = '';
}
function selectStash(stash) {
stashes.value.push(stash);
function selectStash(selectedStash) {
if (!stashes.value.some((stash) => stash.id === selectedStash.id)) {
stashes.value.push(selectedStash);
}
}
</script>