diff --git a/package.json b/package.json index cdb185ba1..4668d2d56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.26.2", + "version": "24.28.1", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 426d99b9a..05c63d563 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -87,7 +87,7 @@ const $props = defineProps({ const emit = defineEmits(['onFetch', 'onDataSaved']); const modelValue = computed( () => $props.model ?? `formModel_${route?.meta?.title ?? route.name}` -); +).value; const componentIsRendered = ref(false); const arrayData = useArrayData(modelValue); const isLoading = ref(false); @@ -119,9 +119,10 @@ onMounted(async () => { // Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla state.set(modelValue, $props.formInitialData); - if ($props.autoLoad && !$props.formInitialData && $props.url) await fetch(); - else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data); - + if (!$props.formInitialData) { + if ($props.autoLoad && $props.url) await fetch(); + else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data); + } if ($props.observeFormChanges) { watch( () => formData.value, @@ -245,7 +246,13 @@ function updateAndEmit(evt, val, res) { emit(evt, state.get(modelValue), res); } -defineExpose({ save, isLoading, hasChanges }); +defineExpose({ + save, + isLoading, + hasChanges, + reset, + fetch, +});