From dd36b35bf7f6f8e64b95323efe7c71bd9b487a89 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 23 Dec 2024 17:56:09 +0100 Subject: [PATCH] fix: refs #8197 staticParams and redirect --- src/components/NavBar.vue | 1 + src/components/common/VnSection.vue | 11 ++++++++--- src/components/ui/VnPaginate.vue | 5 ++--- src/components/ui/VnSearchbar.vue | 6 ++++-- src/composables/useArrayData.js | 1 + src/pages/Account/AccountList.vue | 7 +++++-- src/pages/Customer/CustomerList.vue | 1 - .../integration/vnComponent/VnSearchBar.spec.js | 5 ++--- 8 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 9b0393489..08c2410f1 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -59,6 +59,7 @@ const pinnedModulesRef = ref(); 'no-visible': !stateQuery.isLoading().value, }" size="xs" + data-cy="loading-spinner" /> diff --git a/src/components/common/VnSection.vue b/src/components/common/VnSection.vue index e6afea4b6..e69e586b5 100644 --- a/src/components/common/VnSection.vue +++ b/src/components/common/VnSection.vue @@ -34,15 +34,20 @@ const $props = defineProps({ type: Object, default: null, }, + redirect: { + type: Boolean, + default: true, + }, }); const sectionValue = computed(() => $props.section ?? $props.dataKey); - +let arrayData; onBeforeMount(() => { if ($props.dataKey) - useArrayData($props.dataKey, { + arrayData = useArrayData($props.dataKey, { searchUrl: 'table', ...$props.arrayDataProps, + navigate: $props.redirect, }); }); @@ -63,12 +68,12 @@ onBeforeMount(() => { - diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 42f558f89..a2ccd5d92 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -112,7 +112,6 @@ onMounted(async () => { onBeforeUnmount(() => { arrayData.resetPagination(); - arrayData.reset(['currentFilter', 'userParams', 'userFilter']); }); watch( @@ -142,7 +141,7 @@ const addFilter = async (filter, params) => { async function fetch(params) { useArrayData(props.dataKey, params); arrayData.resetPagination(); - await arrayData.fetch({ append: false, updateRouter: mounted.value }); + await arrayData.fetch({ append: false }); return emitStoreData(); } @@ -217,7 +216,7 @@ defineExpose({