Fix create M2M field concurrency (#9220)

* fix create m2m field concurrency

* remove unused import

* Re-add missing store

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
José Varela
2021-11-24 21:18:18 +00:00
committed by GitHub
parent bebea58a88
commit ebd17abae2
2 changed files with 3 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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<Collection & { fields: Field[] }>) {
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<Collection>) {