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:
parent
12eb91365a
commit
a28bbfc8df
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue