fix: condition增加异常保护

This commit is contained in:
林熠 2020-07-30 12:51:22 +08:00
parent 7171aa218d
commit 83243686f5

View File

@ -18,7 +18,13 @@ class SettingFieldView extends Component<{ field: SettingField }> {
const { field } = this.props;
const { extraProps } = field;
const { condition, defaultValue, display } = extraProps;
const visible = field.isSingle && typeof condition === 'function' ? condition(field) !== false : true;
let visible;
try {
visible = field.isSingle && typeof condition === 'function' ? condition(field) !== false : true;
} catch (error) {
console.error('exception when condition (hidden) is excuted', error);
}
if (!visible) {
return null;
}