From 2e02027a00871d87427e4d6218b532ac848dc697 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 5 Jul 2024 14:11:50 +0200 Subject: [PATCH] fix: cardDescriptor --- src/components/ui/CardDescriptor.vue | 4 ++-- src/pages/Entry/Card/EntryDescriptor.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index e4e007567..380806540 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -58,8 +58,8 @@ onBeforeMount(async () => { store = arrayData.store; entity = computed(() => { const data = Array.isArray(store.data) ? store.data[0] : store.data; - emit('onFetch', data); - return data; + if (data) emit('onFetch', data ?? {}); + return data ?? {}; }); // It enables to load data only once if the module is the same as the dataKey diff --git a/src/pages/Entry/Card/EntryDescriptor.vue b/src/pages/Entry/Card/EntryDescriptor.vue index a55ad67cd..3efdf1bf7 100644 --- a/src/pages/Entry/Card/EntryDescriptor.vue +++ b/src/pages/Entry/Card/EntryDescriptor.vue @@ -73,7 +73,7 @@ onMounted(async () => { const data = ref(useCardDescription()); const setData = (entity) => - (data.value = useCardDescription(entity.supplier.nickname, entity.id)); + (data.value = useCardDescription(entity.supplier?.nickname, entity.id)); const currentEntry = computed(() => state.get('entry'));