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