From b7847ab3512393a1f858bcf41cef6988da6ad25b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 4 Jan 2024 10:15:03 +0100 Subject: [PATCH] refs #6611 fix: QpoupProxy descriptor bug --- src/components/ui/CardDescriptor.vue | 2 +- src/composables/useArrayData.js | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 2669b53a9..664147bd3 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -62,7 +62,7 @@ async function getData() { filter: $props.filter, skip: 0, }); - const { data } = await arrayData.fetch({ append: false }); + const { data } = await arrayData.fetch({ append: false, updateRouter: false }); entity.value = data; emit('onFetch', data); } diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 523340cc9..26d77ef6b 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -58,7 +58,7 @@ export function useArrayData(key, userOptions) { } } - async function fetch({ append = false }) { + async function fetch({ append = false, updateRouter = true }) { if (!store.url) return; cancelRequest(); @@ -100,15 +100,12 @@ export function useArrayData(key, userOptions) { hasMoreData.value = response.data.length === limit; - if (append === true) { - if (!store.data) store.data = []; - for (const row of response.data) store.data.push(row); - } - - if (append === false) { + if (append) { + store.data = response.data.map(({ row }) => row); + } else { store.data = response.data; - updateStateParams(); + updateRouter && updateStateParams(); } store.isLoading = false; @@ -155,7 +152,9 @@ export function useArrayData(key, userOptions) { delete store.userParams[param]; delete params[param]; if (store.filter?.where) { - delete store.filter.where[Object.keys(exprBuilder ? exprBuilder(param) : param)[0]]; + delete store.filter.where[ + Object.keys(exprBuilder ? exprBuilder(param) : param)[0] + ]; if (Object.keys(store.filter.where).length === 0) { delete store.filter.where; }