fix: undefined type in useDataBlockProps() (#5365)

This commit is contained in:
Katherine 2024-10-08 13:49:55 +08:00 committed by GitHub
parent 0b863899bf
commit 55cdfadee7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -166,7 +166,7 @@ export const createSubmitActionSettings = new SchemaSettings({
name: 'saveMode',
Component: SaveMode,
useVisible() {
const { type } = useDataBlockProps();
const { type } = useDataBlockProps() || ({} as any);
return type !== 'publicForm';
},
},

View File

@ -27,7 +27,7 @@ const commonOptions = {
title: '{{t("Custom request")}}',
Component: 'CustomRequestInitializer',
useVisible() {
const { type } = useDataBlockProps();
const { type } = useDataBlockProps() || ({} as any);
return type !== 'publicForm';
},
},

View File

@ -359,7 +359,7 @@ export const selectComponentFieldSettings = new SchemaSettings({
const isAssociationField = useIsAssociationField();
const readPretty = useIsFieldReadPretty();
const { fieldSchema } = useColumnSchema();
const { type } = useDataBlockProps();
const { type } = useDataBlockProps() || ({} as any);
return isAssociationField && !fieldSchema && !readPretty && type !== 'publicForm';
},
},

View File

@ -107,7 +107,7 @@ export const useImportStartAction = () => {
const { setVisible, fieldSchema } = useActionContext();
const { setImportModalVisible, setImportStatus, setImportResult } = useImportContext();
const { upload } = form.values;
const dataBlockProps = useDataBlockProps();
const dataBlockProps = useDataBlockProps() || ({} as any);
const headers = useDataSourceHeaders(dataBlockProps.dataSource);
useEffect(() => {
form.reset();