From 1a697aa018d3bfac296074b874a00b1d8bed8e44 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 1 Oct 2024 15:02:42 +0200 Subject: [PATCH 1/4] feat: refs #7679 #7679 add sortBy and limit --- src/components/CreateNewPostcodeForm.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index 99cba5360..32e2e6f8b 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -125,16 +125,26 @@ async function handleCountries(data) { - + Date: Tue, 1 Oct 2024 21:56:12 +0200 Subject: [PATCH 2/4] perf: refs #7679 add sortBy & limit whe retrieve Autonomies --- src/components/CreateNewProvinceForm.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/CreateNewProvinceForm.vue b/src/components/CreateNewProvinceForm.vue index 4c1d96930..3c1f6b6f2 100644 --- a/src/components/CreateNewProvinceForm.vue +++ b/src/components/CreateNewProvinceForm.vue @@ -46,6 +46,8 @@ const onDataSaved = (dataSaved, requestResponse) => { }, }" url="Autonomies/location" + :sort-by="['name ASC']" + :limit="100" /> Date: Wed, 2 Oct 2024 09:29:05 +0200 Subject: [PATCH 3/4] perf: refs #7679 #7679 improve watch --- src/components/CreateNewPostcodeForm.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index 32e2e6f8b..c6bf8be10 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -79,14 +79,20 @@ async function onProvinceCreated(data) { watch( () => [postcodeFormData.countryFk], async (newCountryFk, oldValueFk) => { - if (!!oldValueFk[0] && newCountryFk[0] !== oldValueFk[0]) { + if (Array.isArray(newCountryFk)) { + newCountryFk = newCountryFk[0]; + } + if (Array.isArray(oldValueFk)) { + oldValueFk = oldValueFk[0]; + } + if (!!oldValueFk && newCountryFk !== oldValueFk) { postcodeFormData.provinceFk = null; postcodeFormData.townFk = null; } - if ((newCountryFk, newCountryFk !== postcodeFormData.countryFk)) { + if (oldValueFk !== newCountryFk) { await provincesFetchDataRef.value.fetch({ where: { - countryFk: newCountryFk[0], + countryFk: newCountryFk, }, }); await townsFetchDataRef.value.fetch({ @@ -103,9 +109,12 @@ watch( watch( () => postcodeFormData.provinceFk, async (newProvinceFk) => { - if (newProvinceFk[0] && newProvinceFk[0] !== postcodeFormData.provinceFk) { + if (Array.isArray(newProvinceFk)) { + newProvinceFk = newProvinceFk[0]; + } + if (newProvinceFk !== postcodeFormData.provinceFk) { await townsFetchDataRef.value.fetch({ - where: { provinceFk: newProvinceFk[0] }, + where: { provinceFk: newProvinceFk }, }); } } From 801b6585e84eda8fbe8842fdbd483e14b7259591 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 9 Oct 2024 00:44:54 +0200 Subject: [PATCH 4/4] perf: refs #7679 change limit value --- src/components/CreateNewPostcodeForm.vue | 6 +++--- src/components/CreateNewProvinceForm.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index c6bf8be10..030ca1388 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -135,14 +135,14 @@ async function handleCountries(data) { ref="provincesFetchDataRef" @on-fetch="handleProvinces" :sort-by="['name ASC']" - :limit="100" + :limit="30" auto-load url="Provinces/location" /> diff --git a/src/components/CreateNewProvinceForm.vue b/src/components/CreateNewProvinceForm.vue index 3c1f6b6f2..d7df38f9f 100644 --- a/src/components/CreateNewProvinceForm.vue +++ b/src/components/CreateNewProvinceForm.vue @@ -47,7 +47,7 @@ const onDataSaved = (dataSaved, requestResponse) => { }" url="Autonomies/location" :sort-by="['name ASC']" - :limit="100" + :limit="30" />