diff --git a/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js index 2e638de482..abbbe507ff 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputSelectWithErrors/index.js @@ -144,6 +144,7 @@ InputSelectWithErrors.defaultProps = { labelStyle: {}, onBlur: false, onFocus: () => {}, + selectOptions: [], style: {}, tabIndex: '0', validations: {}, @@ -198,7 +199,7 @@ InputSelectWithErrors.propTypes = { }), PropTypes.string, ]), - ).isRequired, + ), style: PropTypes.object, tabIndex: PropTypes.string, validations: PropTypes.object, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js index a2ceb9ea0b..f357abe16d 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js @@ -146,9 +146,12 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr } handleDelete = (attributeName) => { - const index = findIndex(this.props.modelPage.model.attributes, ['name', attributeName]); - const parallelAttributeIndex = findIndex(this.props.modelPage.model.attributes, (attr) => attr.params.key === attributeName); - + const { modelPage: { model } } = this.props; + const index = findIndex(model.attributes, ['name', attributeName]); + const attributeToRemove = get(model, ['attributes', index]); + const parallelAttributeIndex = attributeToRemove.name === attributeToRemove.params.key ? + -1 : findIndex(model.attributes, (attr) => attr.params.key === attributeName); + this.props.deleteAttribute(index, this.props.match.params.modelName, parallelAttributeIndex !== -1); }