From 20ae555e1404d5b68857c037e652297544d29b68 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 14 Jun 2024 09:21:02 +0200 Subject: [PATCH] fix: refs #6464 fix error isLoading --- src/components/ui/VnFilterPanel.vue | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index fd508cea3..3375ad3f6 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -84,20 +84,23 @@ watch( const isLoading = ref(false); async function search() { - store.filter.where = {}; - isLoading.value = true; - const params = { ...userParams.value }; - store.userParamsChanged = true; - store.filter.skip = 0; - store.skip = 0; - const { params: newParams } = await arrayData.addFilter({ params }); - userParams.value = newParams; + try { + store.filter.where = {}; + isLoading.value = true; + const params = { ...userParams.value }; + store.userParamsChanged = true; + store.filter.skip = 0; + store.skip = 0; + const { params: newParams } = await arrayData.addFilter({ params }); + userParams.value = newParams; - if (!props.showAll && !Object.values(params).length) store.data = []; + if (!props.showAll && !Object.values(params).length) store.data = []; - isLoading.value = false; - emit('search'); - if (props.redirect) navigate(store.data, {}); + emit('search'); + if (props.redirect) navigate(store.data, {}); + } finally { + isLoading.value = false; + } } async function reload() {