From cfc6bc7d115d5500a500dbef625c584e7f335390 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 May 2024 11:51:06 +0200 Subject: [PATCH] perf: improve VnSelect filter --- src/components/common/VnSelect.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 1f03dc0c2..edfd60a6e 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -119,6 +119,8 @@ const arrayData = useURL.value onMounted(async () => { setOptions(options.value); if (useURL.value) { + arrayData.store.userFilter = $props.where; + arrayData.store.filter.where = $props.where; const { data } = await arrayData.fetch({ append: true }); setOptions(data); return; @@ -180,9 +182,9 @@ async function filterHandler(val, update) { myOptionsFiltered.value = []; } else newOptions = filter(val, myOptionsOriginal.value); if (useURL.value && myOptions.value.length < 1) { - // arrayData.store.filter.where = { [optionLabel.value]: val }; + arrayData.store.skip = 0; + arrayData.store.filter.skip = 0; arrayData.store.filter.where = { [optionFilter.value]: val }; - // arrayData.store.filter.where = buildwhere(val); const { data } = await arrayData.fetch({ append: false }); newOptions = data; myOptionsFiltered.value = data;