From ddc18aa17739963afa5d156241aa07b7100374f4 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Fri, 5 Jul 2024 14:31:57 +0200 Subject: [PATCH] feat: remove props destructuring from KanbanCard --- .../components/tasks/partials/KanbanCard.vue | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/tasks/partials/KanbanCard.vue b/frontend/src/components/tasks/partials/KanbanCard.vue index 1b33c5446..399049ae5 100644 --- a/frontend/src/components/tasks/partials/KanbanCard.vue +++ b/frontend/src/components/tasks/partials/KanbanCard.vue @@ -114,19 +114,18 @@ import AssigneeList from '@/components/tasks/partials/AssigneeList.vue' import {playPopSound} from '@/helpers/playPop' import {isEditorContentEmpty} from '@/helpers/editorContentEmpty' -const { - task, - loading = false, -} = defineProps<{ +const props = withDefaults(defineProps<{ task: ITask, loading: boolean, -}>() +}>(), { + loading: false, +}) const router = useRouter() const loadingInternal = ref(false) -const color = computed(() => getHexColor(task.hexColor)) +const color = computed(() => getHexColor(props.task.hexColor)) async function toggleTaskDone(task: ITask) { loadingInternal.value = true @@ -147,7 +146,7 @@ async function toggleTaskDone(task: ITask) { function openTaskDetail() { router.push({ name: 'task.detail', - params: {id: task.id}, + params: {id: props.task.id}, state: {backdropView: router.currentRoute.value.fullPath}, }) } @@ -155,12 +154,12 @@ function openTaskDetail() { const coverImageBlobUrl = ref(null) async function maybeDownloadCoverImage() { - if (!task.coverImageAttachmentId) { + if (!props.task.coverImageAttachmentId) { coverImageBlobUrl.value = null return } - const attachment = task.attachments.find(a => a.id === task.coverImageAttachmentId) + const attachment = props.task.attachments.find(a => a.id === props.task.coverImageAttachmentId) if (!attachment || !SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.toLowerCase().endsWith(suffix))) { return } @@ -170,7 +169,7 @@ async function maybeDownloadCoverImage() { } watch( - () => task.coverImageAttachmentId, + () => props.task.coverImageAttachmentId, maybeDownloadCoverImage, {immediate: true}, )