link: set attributes at once

This commit is contained in:
Yuri Kuznetsov
2024-07-15 11:48:05 +03:00
parent bac385545c
commit 9339082f9b
+8 -6
View File
@@ -409,15 +409,17 @@ class LinkFieldView extends BaseFieldView {
this.controlCreateButtonVisibility();
const attributes = {};
for (const [foreign, field] of Object.entries(this.getDependantForeignMap())) {
this.model.set(field, model.get(foreign))
attributes[field] = model.get(foreign);
}
this.getSelectFieldHandler().then(handler => {
handler.getAttributes(model)
.then(attributes => {
this.model.set(attributes)
});
this.getSelectFieldHandler().then(async handler => {
this.model.set({
...attributes,
...(await handler.getAttributes(model)),
});
});
}