From aec43cb1c5ab555d623300bbb072d4917b733384 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 4 Jul 2024 12:51:46 +0200 Subject: [PATCH 1/7] refactor: arrayData & VnCard refactor --- src/components/common/VnCard.vue | 2 +- src/composables/useArrayData.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index c81bcd8e2..17fa74317 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -39,7 +39,7 @@ const arrayData = useArrayData(props.dataKey, { onBeforeMount(async () => { if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id }; - await arrayData.fetch({ append: false }); + await arrayData.fetch({ append: false, updateRouter: false }); }); if (props.baseUrl) { diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index db59b7d78..8fda4b15d 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -84,8 +84,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } Object.assign(filter, store.userFilter, exprFilter); - Object.assign(store.filter, filter); - const params = { filter: store.filter }; + const where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); + Object.assign(filter, store.filter); + filter.where = where; + const params = { filter }; Object.assign(params, userParams); params.filter.skip = store.skip; @@ -143,7 +145,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function addFilter({ filter, params }) { - if (filter) store.userFilter = Object.assign(store.userFilter, filter); + if (filter) store.filter = filter; let userParams = { ...store.userParams, ...params }; userParams = sanitizerParams(userParams, store?.exprBuilder); @@ -157,7 +159,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } async function addFilterWhere(where) { - const storedFilter = { ...store.userFilter }; + const storedFilter = { ...store.filter }; if (!storedFilter?.where) storedFilter.where = {}; where = { ...storedFilter.where, ...where }; await addFilter({ filter: { where } }); @@ -187,7 +189,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { store.page += 1; await fetch({ append: true }); - updateStateParams(); } async function refresh() { From 699f09cfcff954e047b7f2a59be5851a8b2a50d9 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 4 Jul 2024 13:17:58 +0200 Subject: [PATCH 2/7] fix: where empty --- src/composables/useArrayData.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 8fda4b15d..e5461c872 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -84,7 +84,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } Object.assign(filter, store.userFilter, exprFilter); - const where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); + let where; + if (filter?.where || store.filter?.where) + where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); Object.assign(filter, store.filter); filter.where = where; const params = { filter }; From c6ae1aec36877095e899926503942dd64c8555e1 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 4 Jul 2024 13:41:43 +0200 Subject: [PATCH 3/7] refs #7366 fix travel --- src/pages/Travel/Card/TravelDescriptor.vue | 3 --- src/pages/Travel/TravelList.vue | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/Travel/Card/TravelDescriptor.vue b/src/pages/Travel/Card/TravelDescriptor.vue index b74761b37..60929031d 100644 --- a/src/pages/Travel/Card/TravelDescriptor.vue +++ b/src/pages/Travel/Card/TravelDescriptor.vue @@ -54,7 +54,6 @@ const entityId = computed(() => { }); const data = ref(useCardDescription()); -const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.id));