From 83243686f51987481fa15c6fb4d8b273374b6339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=86=A0?= Date: Thu, 30 Jul 2020 12:51:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20condition=E5=A2=9E=E5=8A=A0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/settings/settings-pane.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/editor-skeleton/src/components/settings/settings-pane.tsx b/packages/editor-skeleton/src/components/settings/settings-pane.tsx index 76ea9c282..6ad763ac1 100644 --- a/packages/editor-skeleton/src/components/settings/settings-pane.tsx +++ b/packages/editor-skeleton/src/components/settings/settings-pane.tsx @@ -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; }