diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts
index ce246fe35..28c498082 100644
--- a/packages/core/client/src/block-provider/hooks/index.ts
+++ b/packages/core/client/src/block-provider/hooks/index.ts
@@ -112,7 +112,7 @@ export const useCreateActionProps = () => {
const variables = useVariables();
const localVariables = useLocalVariables({ currentForm: form });
const { getActiveFieldsName } = useFormActiveFields() || {};
-
+ const { t } = useTranslation();
const action = actionField.componentProps.saveMode || 'create';
const filterKeys = actionField.componentProps.filterKeys?.checked || [];
return {
@@ -187,6 +187,8 @@ export const useCreateActionProps = () => {
__parent?.service?.refresh?.();
setVisible?.(false);
if (!onSuccess?.successMessage) {
+ message.success(t('Saved successfully'));
+ await form.reset();
return;
}
if (onSuccess?.manualClose) {
@@ -205,6 +207,7 @@ export const useCreateActionProps = () => {
});
} else {
message.success(compile(onSuccess?.successMessage));
+ await form.reset();
if (onSuccess?.redirecting && onSuccess?.redirectTo) {
if (isURL(onSuccess.redirectTo)) {
window.location.href = onSuccess.redirectTo;
diff --git a/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx b/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx
index d97737223..59acbb697 100644
--- a/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx
+++ b/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx
@@ -58,6 +58,11 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
const api = useAPIClient();
const resource = api.resource(collectionField.target);
const linkageFields = filterAnalyses(field.componentProps?.service?.params?.filter);
+ useEffect(() => {
+ const initValue = isVariable(field.value) ? undefined : field.value;
+ const value = Array.isArray(initValue) ? initValue.filter(Boolean) : initValue;
+ setInnerValue(value);
+ }, [field.value]);
useEffect(() => {
const id = uid();
form.addEffects(id, () => {
@@ -111,7 +116,6 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
);
};
-
return (
@@ -124,7 +128,6 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
service={service}
onChange={(value) => {
const val = value?.length !== 0 ? value : null;
- setInnerValue(val);
props.onChange?.(val);
}}
CustomDropdownRender={addMode === 'quickAdd' && QuickAddContent}
diff --git a/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx b/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx
index c81517e33..d7a935b55 100644
--- a/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx
+++ b/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx
@@ -96,6 +96,8 @@ const InternalFileManager = (props) => {
};
});
setOptions(opts);
+ } else {
+ setOptions([]);
}
}, [value, fieldNames?.label]);
diff --git a/packages/core/client/src/schema-component/antd/input/Json.tsx b/packages/core/client/src/schema-component/antd/input/Json.tsx
index 0af77e35a..b4f841a33 100644
--- a/packages/core/client/src/schema-component/antd/input/Json.tsx
+++ b/packages/core/client/src/schema-component/antd/input/Json.tsx
@@ -15,6 +15,8 @@ export const Json = React.forwardRef(
try {
if (value != null) {
setText(JSON.stringify(value, null, space));
+ } else {
+ setText(undefined);
}
} catch (ex) {
//
diff --git a/packages/core/client/src/schema-component/antd/upload/Upload.tsx b/packages/core/client/src/schema-component/antd/upload/Upload.tsx
index f27e178ff..c156a2929 100644
--- a/packages/core/client/src/schema-component/antd/upload/Upload.tsx
+++ b/packages/core/client/src/schema-component/antd/upload/Upload.tsx
@@ -33,7 +33,6 @@ Upload.Attachment = connect((props: UploadProps) => {
const { t } = useTranslation();
const uploadProps = useUploadProps({ ...props });
const { wrapSSR, hashId, componentCls: prefixCls } = useStyles();
-
const internalFileList = useRef([]);
function closeIFrameModal() {
@@ -169,6 +168,7 @@ Upload.Attachment = connect((props: UploadProps) => {
onChange?.(toValue(list));
}
setFileList(list.map(toItem));
+ setSync(true);
} else {
if (info.file.status === 'done') {
// TODO(BUG): object 的联动有问题,不响应,折中的办法先置空再赋值
@@ -176,6 +176,7 @@ Upload.Attachment = connect((props: UploadProps) => {
onChange?.(info.file?.response?.data);
}
setFileList([toItem(info.file)]);
+ setSync(true);
}
}}
showUploadList={false}
@@ -229,6 +230,7 @@ Upload.Attachment = connect((props: UploadProps) => {
onCancel={closeIFrameModal}
footer={[
,
-