diff --git a/packages/client/src/constate/Collections.ts b/packages/client/src/constate/Collections.ts index a615d2453..86a3c3769 100644 --- a/packages/client/src/constate/Collections.ts +++ b/packages/client/src/constate/Collections.ts @@ -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 || []; diff --git a/packages/client/src/schemas/add-new/index.tsx b/packages/client/src/schemas/add-new/index.tsx index afb7bc271..efdb46138 100644 --- a/packages/client/src/schemas/add-new/index.tsx +++ b/packages/client/src/schemas/add-new/index.tsx @@ -445,7 +445,7 @@ AddNew.CardItem = observer((props: any) => { }, }); await createOrUpdateCollection(values); - refresh(); + await refresh(); data = generateCardItemSchema( info.key === 'addNewTable' ? 'Table' : 'Form', );