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