fix: solve cancelledSignal
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-09-13 21:31:47 +02:00
parent e621810f62
commit 82da5c2228
1 changed files with 2 additions and 14 deletions

View File

@ -127,7 +127,7 @@ const arrayData = useArrayData(arrayDataKey, { url: $props.url });
onMounted(async () => { onMounted(async () => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300); if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
setOptions(options.value); setOptions(options.value);
if (useURL.value) await fetchFilter($props.modelValue); if (useURL.value && $props.modelValue) await fetchFilter($props.modelValue);
}); });
watch(options, (newValue) => { watch(options, (newValue) => {
setOptions(newValue); setOptions(newValue);
@ -140,18 +140,6 @@ watch(modelValue, async (newValue) => {
if ($props.noOne) myOptions.value.unshift(noOneOpt.value); if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
}); });
onMounted(async () => {
setOptions(options.value);
if ($props.url && $props.modelValue && !findKeyInOptions())
await fetchFilter($props.modelValue);
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
function findKeyInOptions() {
if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length;
}
function setOptions(data, append = true) { function setOptions(data, append = true) {
myOptions.value = JSON.parse(JSON.stringify(data)); myOptions.value = JSON.parse(JSON.stringify(data));
if (append) myOptionsOriginal.value = JSON.parse(JSON.stringify(data)); if (append) myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
@ -209,7 +197,7 @@ async function fetchFilter(val) {
arrayData.store.filter.skip = 0; arrayData.store.filter.skip = 0;
const { data } = await arrayData.fetch({ append: true, updateRouter: false }); const { data } = await arrayData.fetch({ append: true, updateRouter: false });
setOptions(data); setOptions(data);
// return data; return data;
} }
async function filterHandler(val, update) { async function filterHandler(val, update) {