From c1820dfcdc85243ff81733a343c992845b31711d Mon Sep 17 00:00:00 2001 From: Severino Date: Tue, 17 Oct 2023 16:07:43 +0200 Subject: [PATCH] fixed computed not returning in all cases --- resources/js/components/attribute/Iconclass.vue | 2 ++ resources/js/components/attribute/Rism.vue | 1 + resources/js/components/modals/attribute/Edit.vue | 6 ++++-- resources/js/components/notification/NotificationBody.vue | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/js/components/attribute/Iconclass.vue b/resources/js/components/attribute/Iconclass.vue index e669e7cf0..73296dca5 100644 --- a/resources/js/components/attribute/Iconclass.vue +++ b/resources/js/components/attribute/Iconclass.vue @@ -158,11 +158,13 @@ if(state.infoLoaded) { return state.info.kw[state.language] ? state.info.kw[state.language] : state.info.kw['en']; } + return [] }), text: computed(_ => { if(state.infoLoaded) { return state.info.txt[state.language] ? state.info.txt[state.language] : state.info.txt['en']; } + return '' }), }); const v = reactive({ diff --git a/resources/js/components/attribute/Rism.vue b/resources/js/components/attribute/Rism.vue index b86580989..4c0d45388 100644 --- a/resources/js/components/attribute/Rism.vue +++ b/resources/js/components/attribute/Rism.vue @@ -173,6 +173,7 @@ } return t('main.entity.attributes.rism.doesnt_exist'); } + return '' }), }); const v = reactive({ diff --git a/resources/js/components/modals/attribute/Edit.vue b/resources/js/components/modals/attribute/Edit.vue index 5ddb55cce..b6f771e69 100644 --- a/resources/js/components/modals/attribute/Edit.vue +++ b/resources/js/components/modals/attribute/Edit.vue @@ -365,8 +365,8 @@ }), operatorList: computed(_ => { if(!state.attributeSelected) return []; - - switch(state.dependency.attribute.datatype) { + const datatype = state.dependency.attribute.datatype + switch(datatype) { case 'epoch': case 'timeperiod': case 'dimension': @@ -419,6 +419,8 @@ return false; } }); + default: + throw new Error(`Unsupported datatype ${datatype}`); } }), inputType: computed(_ => { diff --git a/resources/js/components/notification/NotificationBody.vue b/resources/js/components/notification/NotificationBody.vue index 564529e07..331de633b 100644 --- a/resources/js/components/notification/NotificationBody.vue +++ b/resources/js/components/notification/NotificationBody.vue @@ -288,6 +288,8 @@ return 'comment'; case 'App\\Notifications\\EntityUpdated': return 'entity'; + default: + throw new Error(`Unknown notification type: ${type}`) } }), canReply: computed(_ => {