Merge pull request #2203 from jacargentina/master

Fix Content Manager sends me to blank page
This commit is contained in:
Jim LAURIE 2018-11-08 11:28:31 +01:00 committed by GitHub
commit 7e7b75f133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -291,6 +291,15 @@ module.exports = async cb => {
// Update the displayed fields
const updatedListDisplay = prevListDisplay.filter(obj => obj.name !== currentAttr.join());
// Retrieve the model's displayed fields for the `EditPage`
const fieldsPath = getEditDisplayFieldsPath(attrPath);
// Retrieve the previous settings
const prevEditDisplayFields = _.get(prevSchema.models, fieldsPath);
// Update the fields
const updatedEditDisplayFields = prevEditDisplayFields.filter(field => field !== currentAttr.join());
// Set the new layout
_.set(prevSchema.models, fieldsPath, updatedEditDisplayFields);
if (updatedListDisplay.length === 0) {
// Update it with the one from the generated schema
_.set(prevSchema.models, listDisplayPath, _.get(schema.models, listDisplayPath, []));