Added check for config crashing when entity properties are not present (#1394)

Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
This commit is contained in:
Nikhil Nandagopal 2020-10-25 12:37:17 +05:30 committed by GitHub
parent ea0d873ac8
commit 411c2c24c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,19 +74,20 @@ export const EntityProperties = (props: {
"CANVAS_WIDGET" | "ICON_WIDGET" | "SKELETON_WIDGET"
> = entity.type;
config = entityDefinitions[type];
if (config) {
if (isFunction(config)) config = config(entity);
if (isFunction(config)) config = config(entity);
entityProperties = Object.keys(config)
.filter(k => k.indexOf("!") === -1)
.map(widgetProperty => {
return {
propertyName: widgetProperty,
entityName: entity.widgetName,
value: entity[widgetProperty],
step: props.step,
};
});
entityProperties = Object.keys(config)
.filter(k => k.indexOf("!") === -1)
.map(widgetProperty => {
return {
propertyName: widgetProperty,
entityName: entity.widgetName,
value: entity[widgetProperty],
step: props.step,
};
});
}
break;
}
return (