fix: modal app not found

This commit is contained in:
sealday 2024-03-20 19:57:54 +08:00
parent e307b11006
commit f5a83d48da

View File

@ -67,6 +67,8 @@ import {
useRecord,
useSchemaSettingsItem,
useSortFields,
useApp,
ApplicationContext,
} from '..';
import {
BlockRequestContext_deprecated,
@ -970,6 +972,7 @@ export const SchemaSettingsModalItem: FC<SchemaSettingsModalItemProps> = (props)
const record = useCollectionRecord();
const { association } = useDataBlockProps() || {};
const formCtx = useFormBlockContext();
const app = useApp();
// 解决变量`当前对象`值在弹窗中丢失的问题
const { formValue: subFormValue, collection: subFormCollection } = useSubFormValue();
@ -988,6 +991,7 @@ export const SchemaSettingsModalItem: FC<SchemaSettingsModalItemProps> = (props)
{ title: schema.title || title, width },
() => {
return (
<ApplicationContext.Provider value={app}>
<CollectionRecordProvider record={record}>
<FormBlockContext.Provider value={formCtx}>
<SubFormProvider value={{ value: subFormValue, collection: subFormCollection }}>
@ -1033,6 +1037,7 @@ export const SchemaSettingsModalItem: FC<SchemaSettingsModalItemProps> = (props)
</SubFormProvider>
</FormBlockContext.Provider>
</CollectionRecordProvider>
</ApplicationContext.Provider>
);
},
theme,