From ebd17abae273ba9d66f20233d3449b8fac7ae39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Varela?= Date: Wed, 24 Nov 2021 21:18:18 +0000 Subject: [PATCH] Fix create M2M field concurrency (#9220) * fix create m2m field concurrency * remove unused import * Re-add missing store Co-authored-by: Rijk van Zanten --- .../settings/routes/data-model/field-detail/store/index.ts | 2 ++ app/src/stores/collections.ts | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/modules/settings/routes/data-model/field-detail/store/index.ts b/app/src/modules/settings/routes/data-model/field-detail/store/index.ts index dd543df940..32e44a0c44 100644 --- a/app/src/modules/settings/routes/data-model/field-detail/store/index.ts +++ b/app/src/modules/settings/routes/data-model/field-detail/store/index.ts @@ -173,6 +173,8 @@ export const useFieldDetailStore = defineStore({ for (const collection of Object.keys(this.items)) { await api.post(`/items/${collection}`, this.items[collection]); } + + await fieldsStore.hydrate(); } catch (err: any) { unexpectedError(err); } finally { diff --git a/app/src/stores/collections.ts b/app/src/stores/collections.ts index 23209df5fe..e635ffe98b 100644 --- a/app/src/stores/collections.ts +++ b/app/src/stores/collections.ts @@ -10,7 +10,7 @@ import formatTitle from '@directus/format-title'; import { defineStore } from 'pinia'; import { COLLECTIONS_DENY_LIST } from '@/constants'; import { isEqual, orderBy, omit } from 'lodash'; -import { useFieldsStore, useRelationsStore } from '.'; +import { useRelationsStore } from './relations'; export const useCollectionsStore = defineStore({ id: 'collectionsStore', @@ -93,7 +93,6 @@ export const useCollectionsStore = defineStore({ }); }, async upsertCollection(collection: string, values: DeepPartial) { - const fieldsStore = useFieldsStore(); const existing = this.getCollection(collection); // Strip out any fields the app might've auto-generated at some point @@ -122,8 +121,6 @@ export const useCollectionsStore = defineStore({ } } catch (err: any) { unexpectedError(err); - } finally { - await fieldsStore.hydrate(); } }, async updateCollection(collection: string, updates: DeepPartial) {