diff --git a/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js b/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js index 2f76e81b9e390b21d147f0f0ca0d191c3c3f6ffc..5f4eb8c8776a7c49fc901298677bb0fa19cbbf5b 100644 --- a/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js +++ b/openbis_ng_ui/src/js/components/types/form/entitytype/EntityTypeFormControllerChange.js @@ -243,27 +243,32 @@ export default class EntityTypeFormControllerChange extends PageControllerChange ) { const { object, facade } = this.controller - facade.loadTypeUsages(object).then(typeUsages => { - this.context.setState(state => { - const index = state.properties.findIndex( - property => property.id === newProperty.id - ) - if (index === -1) { - return {} - } - const newProperties = Array.from(state.properties) - newProperties[index] = { - ...newProperties[index], - initialValueForExistingEntities: { - ...newProperties[index].initialValueForExistingEntities, - visible: typeUsages > 0 + facade + .loadTypeUsages(object) + .then(typeUsages => { + this.context.setState(state => { + const index = state.properties.findIndex( + property => property.id === newProperty.id + ) + if (index === -1) { + return {} } - } - return { - properties: newProperties - } + const newProperties = Array.from(state.properties) + newProperties[index] = { + ...newProperties[index], + initialValueForExistingEntities: { + ...newProperties[index].initialValueForExistingEntities, + visible: typeUsages > 0 + } + } + return { + properties: newProperties + } + }) + }) + .catch(error => { + AppController.getInstance().errorChange(error) }) - }) } else { _.assign(newProperty, { initialValueForExistingEntities: {