You've already forked DataMate
fix: 恢复前端发送空字符串以支持清除关联数据集
修改说明: 移除了之前将空字符串转换为 undefined 的逻辑, 现在直接发送表单值,包括空字符串。 配合后端修改(commit cc6415c): 1. 当用户选择"无关联数据集"时,发送空字符串 "" 2. 后端 handleParentChange 方法通过 normalizeParentId 将空字符串转为 null 3. Dataset.parentDatasetId 字段添加了 @TableField(updateStrategy = FieldStrategy.IGNORED) 4. 确保即使值为 null 也会被更新到数据库
This commit is contained in:
@@ -58,8 +58,6 @@ export default function EditDataset({
|
|||||||
const params = {
|
const params = {
|
||||||
...formValues,
|
...formValues,
|
||||||
files: undefined,
|
files: undefined,
|
||||||
// 将空字符串转换为 undefined,以便后端正确识别为清除关联数据集
|
|
||||||
parentDatasetId: formValues.parentDatasetId || undefined,
|
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await updateDatasetByIdUsingPut(data?.id, params);
|
await updateDatasetByIdUsingPut(data?.id, params);
|
||||||
|
|||||||
Reference in New Issue
Block a user