fix: refresh list automatically after closing modal following add operation (#4699)

This commit is contained in:
Katherine 2024-06-19 09:54:10 +08:00 committed by GitHub
parent 2300104586
commit eaa06441d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,15 +98,19 @@ const InternalCreateRecordAction = (props: any, ref) => {
return (
//@ts-ignore
<div ref={buttonRef as React.Ref<HTMLButtonElement>}>
<ActionContextProvider value={{ ...ctx, fieldSchema, visible, setVisible }}>
<CreateAction
{...props}
onClick={(collectionData) => {
<CreateAction
{...props}
onClick={(collectionData) => {
if (collectionData.name === collection.name) {
ctx?.setVisible(true);
} else {
setVisible(true);
setCurrentCollection(collectionData.name);
setCurrentCollectionDataSource(collectionData.dataSource);
}}
/>
}
setCurrentCollection(collectionData.name);
setCurrentCollectionDataSource(collectionData.dataSource);
}}
/>
<ActionContextProvider value={{ ...ctx, fieldSchema, visible, setVisible }}>
<CollectionProvider_deprecated name={currentCollection} dataSource={currentCollectionDataSource}>
<RecursionField schema={fieldSchema} basePath={field.address} onlyRenderProperties />
</CollectionProvider_deprecated>