fix: await refresh
This commit is contained in:
parent
b9b43b9712
commit
70652c9bf7
@ -17,11 +17,11 @@ export interface CollectionProviderProps {
|
|||||||
const [CollectionProvider, useCollectionContext] = constate(
|
const [CollectionProvider, useCollectionContext] = constate(
|
||||||
(props: CollectionProviderProps) => {
|
(props: CollectionProviderProps) => {
|
||||||
const { collectionName } = props;
|
const { collectionName } = props;
|
||||||
const { data = [], loading, refresh } = useCollectionsContext();
|
const { collections = [], loading, refresh } = useCollectionsContext();
|
||||||
let collection: any;
|
let collection: any;
|
||||||
let fields = [];
|
let fields = [];
|
||||||
if (collectionName) {
|
if (collectionName) {
|
||||||
collection = data.find((item) => item.name === collectionName);
|
collection = collections.find((item) => item.name === collectionName);
|
||||||
}
|
}
|
||||||
if (collection) {
|
if (collection) {
|
||||||
fields = collection?.fields || [];
|
fields = collection?.fields || [];
|
||||||
|
@ -445,7 +445,7 @@ AddNew.CardItem = observer((props: any) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
await createOrUpdateCollection(values);
|
await createOrUpdateCollection(values);
|
||||||
refresh();
|
await refresh();
|
||||||
data = generateCardItemSchema(
|
data = generateCardItemSchema(
|
||||||
info.key === 'addNewTable' ? 'Table' : 'Form',
|
info.key === 'addNewTable' ? 'Table' : 'Form',
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user