fix: await refresh

This commit is contained in:
chenos 2021-07-30 18:41:10 +08:00
parent b9b43b9712
commit 70652c9bf7
2 changed files with 3 additions and 3 deletions

View File

@ -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 || [];

View File

@ -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',
); );