diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue
index 258ed64e4..a49e01b76 100644
--- a/src/components/common/VnCard.vue
+++ b/src/components/common/VnCard.vue
@@ -1,5 +1,5 @@
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index aabbfbc5b..88dfb7f22 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -1,4 +1,4 @@
-import { onMounted, ref, computed } from 'vue';
+import { onMounted, ref, computed, onUnmounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import { useArrayDataStore } from 'stores/useArrayDataStore';
@@ -18,6 +18,10 @@ export function useArrayData(key, userOptions) {
const page = ref(1);
+ onUnmounted(() => {
+ destroy();
+ });
+
onMounted(() => {
setOptions();
store.skip = 0;
@@ -30,6 +34,7 @@ export function useArrayData(key, userOptions) {
delete params.filter;
store.userParams = { ...params, ...store.userParams };
store.userFilter = { ...JSON.parse(filter), ...store.userFilter };
+ console.log('store.userParams', store.userParams, store.userFilter);
}
});
@@ -121,6 +126,7 @@ export function useArrayData(key, userOptions) {
}
function destroy() {
+ console.log('DESTROY', key);
if (arrayDataStore.get(key)) {
arrayDataStore.clear(key);
}
@@ -217,10 +223,14 @@ export function useArrayData(key, userOptions) {
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`)
: path.replace(/:id.*/, '');
+ console.log('to: ', to, store.userParams, store.userFilter, route.query);
if (route.path != to) {
- store.userParams = {};
- store.userFilter = {};
- return router.push({ path: to });
+ destroy();
+ const pushUrl = { path: to };
+ if (to.endsWith('/list') || to.endsWith('/'))
+ pushUrl.query = newUrl.query;
+ console.log('pushUrl: ', to, pushUrl.query);
+ return router.push(pushUrl);
}
}