fix(labels): only show each label once

Sometimes™, directly after adding a label, it would show up multiple times. Sometimes, it was reproducible, other times it was not. This now fixes this by only showing labels unique by its id.
This commit is contained in:
kolaente 2025-03-09 11:38:45 +01:00
parent 12eb91365a
commit a28bbfc8df
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
2 changed files with 7 additions and 4 deletions

View File

@ -87,7 +87,7 @@ const query = ref('')
watch(
() => props.modelValue,
(value) => {
labels.value = value
labels.value = Array.from(new Map(value.map(label => [label.id, label])).values())
},
{
immediate: true,

View File

@ -1,7 +1,7 @@
<template>
<div class="label-wrapper">
<XLabel
v-for="label in labels"
v-for="label in displayLabels"
:key="label.id"
:label="label"
/>
@ -9,13 +9,16 @@
</template>
<script setup lang="ts">
import type {ILabel} from '@/modelTypes/ILabel'
import {computed} from 'vue'
import type {ILabel} from '@/modelTypes/ILabel'
import XLabel from '@/components/tasks/partials/Label.vue'
defineProps<{
const props = defineProps<{
labels: ILabel[],
}>()
const displayLabels = computed(() => Array.from(new Map(props.labels.map(label => [label.id, label])).values()))
</script>
<style lang="scss" scoped>