fix: refs #8388 update CrudModel and VnTable to handle async reload and improve event handling
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-05-12 17:17:32 +02:00
parent 54a905d436
commit 5882f47f5f
2 changed files with 7 additions and 2 deletions

View File

@ -11,10 +11,12 @@ import VnConfirm from 'components/ui/VnConfirm.vue';
import SkeletonTable from 'components/ui/SkeletonTable.vue';
import { tMobile } from 'src/composables/tMobile';
import getDifferences from 'src/filters/getDifferences';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
const { push } = useRouter();
const quasar = useQuasar();
const stateStore = useStateStore();
const stateQuery = useStateQueryStore();
const { t } = useI18n();
const { validate } = useValidator();
const $attrs = useAttrs();
@ -190,6 +192,8 @@ async function onSubmit() {
async function onSubmitAndGo() {
await onSubmit();
while (stateQuery.isLoading().value)
await new Promise((resolve) => setTimeout(resolve, 100));
push({ path: $props.goTo });
}

View File

@ -335,10 +335,10 @@ function stopEventPropagation(event) {
event.stopPropagation();
}
function reload(params) {
async function reload(params) {
selected.value = [];
selectAll.value = false;
CrudModelRef.value.reload(params);
await CrudModelRef.value.reload(params);
}
function columnName(col) {
@ -702,6 +702,7 @@ const handleHeaderSelection = (evt, data) => {
:search-url="searchUrl"
:disable-infinite-scroll="isTableMode"
:before-save-fn="removeTextValue"
@save-changes="reload"
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']"
>