diff --git a/app/src/modules/settings/routes/data-model/fields/fields.vue b/app/src/modules/settings/routes/data-model/fields/fields.vue index 2da9046def..76530d4b2d 100644 --- a/app/src/modules/settings/routes/data-model/fields/fields.vue +++ b/app/src/modules/settings/routes/data-model/fields/fields.vue @@ -185,21 +185,18 @@ export default defineComponent({ async function deleteAndQuit() { await remove(); - await collectionsStore.hydrate(); - await fieldsStore.hydrate(); + await Promise.all([collectionsStore.hydrate(), fieldsStore.hydrate()]); router.replace(`/settings/data-model`); } async function saveAndStay() { await save(); - await collectionsStore.hydrate(); - await fieldsStore.hydrate(); + await Promise.all([collectionsStore.hydrate(), fieldsStore.hydrate()]); } async function saveAndQuit() { await save(); - await collectionsStore.hydrate(); - await fieldsStore.hydrate(); + await Promise.all([collectionsStore.hydrate(), fieldsStore.hydrate()]); router.push(`/settings/data-model`); } diff --git a/app/src/modules/settings/routes/data-model/new-collection.vue b/app/src/modules/settings/routes/data-model/new-collection.vue index 1f9a5762a5..65c0bd50f0 100644 --- a/app/src/modules/settings/routes/data-model/new-collection.vue +++ b/app/src/modules/settings/routes/data-model/new-collection.vue @@ -252,18 +252,18 @@ export default defineComponent({ }, }); + const storeHydrations: Promise[] = []; + const relations = getSystemRelations(); if (relations.length > 0) { - for (const relation of relations) { - await api.post('/relations', relation); - } - - await relationsStore.hydrate(); + const requests = relations.map((relation) => api.post('/relations', relation)); + await Promise.all(requests); + storeHydrations.push(relationsStore.hydrate()); } - await collectionsStore.hydrate(); - await fieldsStore.hydrate(); + storeHydrations.push(collectionsStore.hydrate(), fieldsStore.hydrate()); + await Promise.all(storeHydrations); notify({ title: t('collection_created'), diff --git a/app/src/modules/users/routes/item.vue b/app/src/modules/users/routes/item.vue index f0f719407e..e6e9b3fa65 100644 --- a/app/src/modules/users/routes/item.vue +++ b/app/src/modules/users/routes/item.vue @@ -446,8 +446,7 @@ export default defineComponent({ if (newLang && newLang !== locale.value) { await setLanguage(newLang); - await fieldsStore.hydrate(); - await collectionsStore.hydrate(); + await Promise.all([fieldsStore.hydrate(), collectionsStore.hydrate()]); } } diff --git a/app/src/stores/collections.ts b/app/src/stores/collections.ts index 4d4ec3eb51..e95095f882 100644 --- a/app/src/stores/collections.ts +++ b/app/src/stores/collections.ts @@ -165,8 +165,8 @@ export const useCollectionsStore = defineStore({ try { await api.delete(`/collections/${collection}`); - await this.hydrate(); - await relationsStore.hydrate(); + await Promise.all([this.hydrate(), relationsStore.hydrate()]); + notify({ title: i18n.global.t('delete_collection_success'), });