fix: updateAssociationValues (#1903)

This commit is contained in:
katherinehhh 2023-05-23 09:44:17 +08:00 committed by GitHub
parent 920bdf8705
commit 0318034b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1176,12 +1176,17 @@ export const useAssociationNames = (collection) => {
if (schema) { if (schema) {
const associations = getAssociationAppends(schema); const associations = getAssociationAppends(schema);
const appends = flattenNestedList(associations); const appends = flattenNestedList(associations);
console.log(appends, associations); return {
return { appends, updateAssociationValues: appends.filter((v) => associationValues.includes(v)) }; appends,
updateAssociationValues: appends.filter((item) => associationValues.some((suffix) => item.endsWith(suffix))),
};
} }
if (!schema) { if (!schema) {
const associations = getAssociationAppends(formSchema); const associations = getAssociationAppends(formSchema);
const appends = flattenNestedList(associations); const appends = flattenNestedList(associations);
return { appends, updateAssociationValues: appends.filter((v) => associationValues.includes(v)) }; return {
appends,
updateAssociationValues: appends.filter((item) => associationValues.some((suffix) => item.endsWith(suffix))),
};
} }
}; };