mirror of
https://github.com/directus/directus.git
synced 2026-01-23 20:18:11 -05:00
Merge with M2M junction value when validating in drawer-item (#15433)
* Merge with M2M junction value when validating in drawer-item * Simplify for null values * Clear validation error messages on save
This commit is contained in:
@@ -348,8 +348,9 @@ function useActions() {
|
||||
const editsToValidate = props.junctionField ? internalEdits.value[props.junctionField] : internalEdits.value;
|
||||
const fieldsToValidate = props.junctionField ? relatedCollectionFields.value : fieldsWithoutCircular.value;
|
||||
const defaultValues = getDefaultValuesFromFields(fieldsToValidate);
|
||||
const existingValues = props.junctionField ? initialValues?.value?.[props.junctionField] : initialValues?.value;
|
||||
let errors = validateItem(
|
||||
merge({}, defaultValues.value, initialValues.value, editsToValidate),
|
||||
merge({}, defaultValues.value, existingValues, editsToValidate),
|
||||
fieldsToValidate,
|
||||
isNew.value
|
||||
);
|
||||
@@ -357,6 +358,8 @@ function useActions() {
|
||||
if (errors.length > 0) {
|
||||
validationErrors.value = errors;
|
||||
return;
|
||||
} else {
|
||||
validationErrors.value = [];
|
||||
}
|
||||
|
||||
if (props.junctionField && props.relatedPrimaryKey !== '+' && relatedPrimaryKeyField.value) {
|
||||
|
||||
Reference in New Issue
Block a user