fix: handle missing inferred title field (#3239)

This commit is contained in:
Erez Rokah 2020-02-12 10:54:09 +02:00 committed by GitHub
parent 3678053f0c
commit ca8cf71ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,9 @@ const mapStateToProps = (state, ownProps) => {
const { entry, inferedFields, collection } = ownProps;
const label = entry.get('label');
const entryData = entry.get('data');
const defaultTitle = label || entryData.getIn(keyToPathArray(inferedFields.titleField));
const defaultTitle =
label ||
(inferedFields.titleField && entryData.getIn(keyToPathArray(inferedFields.titleField)));
const summaryTemplate = collection.get('summary');
const summary = summaryTemplate
? summaryFormatter(summaryTemplate, entry, collection)