From 5093d0b1a6363a4a53a1dbce9b541603178dc39c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 19 Feb 2024 09:16:26 +0100 Subject: [PATCH] refs #6394 fix: some navigation bugs --- src/components/ui/VnFilterPanel.vue | 15 ++++++++++++++- src/composables/useArrayData.js | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 7504e819e..5d35c4162 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -63,6 +63,19 @@ onMounted(() => { emit('init', { params: userParams.value }); }); +watch( + () => route.query.params, + (val) => { + if (!val) { + userParams.value = {}; + } else { + const parsedParams = JSON.parse(val); + userParams.value = { ...parsedParams }; + search(); + } + } +); + const isLoading = ref(false); async function search() { isLoading.value = true; @@ -70,9 +83,9 @@ async function search() { store.userParamsChanged = true; store.filter.skip = 0; store.skip = 0; + store.userParams = params; const { params: newParams } = await arrayData.addFilter({ params }); userParams.value = newParams; - if (!props.showAll && !Object.values(params).length) store.data = []; isLoading.value = false; diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index b6b81f2d5..f17778585 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -27,6 +27,8 @@ export function useArrayData(key, userOptions) { const query = route.query; if (query.params) { store.userParams = JSON.parse(query.params); + store.skip = 0; + store.filter.skip = 0; } });