fix: association field not submitting data when displaying field from related collection (#6798)

This commit is contained in:
Katherine 2025-04-28 19:27:16 +08:00 committed by GitHub
parent c1f8b4d2f7
commit a28e1d2c39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,18 +105,23 @@ function getFilteredFormValues(form) {
allFields.push(field); allFields.push(field);
} }
}); });
const readonlyPaths = allFields const readonlyPaths = _.uniq(
.filter((field) => field?.componentProps?.readOnlySubmit) allFields
.map((field) => { .filter((field) => field?.componentProps?.readOnlySubmit)
const segments = field.path?.segments || []; .map((field) => {
if (segments.length <= 1) { const segments = field.path?.segments || [];
return segments.join('.'); if (segments.length <= 1) {
} return segments.join('.');
return segments.slice(0, -1).join('.'); }
}); return segments.slice(0, -1).join('.');
for (const path of readonlyPaths) { }),
_.unset(values, path); );
} readonlyPaths.forEach((path, index) => {
if (index !== 0 || path.includes('.')) {
// 清空值,但跳过第一层
_.unset(values, path);
}
});
return values; return values;
} }