Fix #2186: Content Manager sends me to blank page

This commit is contained in:
Javier Castro 2018-10-25 15:05:44 -03:00
parent 74249729e2
commit 1fce5221bb

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, []));