From fe835ad296b45d424bec6703ea5504697fac113c Mon Sep 17 00:00:00 2001 From: Rairn <958414905@qq.com> Date: Wed, 31 May 2023 11:35:20 +0800 Subject: [PATCH] perf(Variable): remove duration --- .../client/src/schema-component/antd/variable/Input.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/variable/Input.tsx b/packages/core/client/src/schema-component/antd/variable/Input.tsx index 35891871d..1debb19da 100644 --- a/packages/core/client/src/schema-component/antd/variable/Input.tsx +++ b/packages/core/client/src/schema-component/antd/variable/Input.tsx @@ -133,11 +133,11 @@ export function Input(props) { const [variableText, setVariableText] = React.useState(''); - const loadData = async (selectedOptions: Option[]) => { + const loadData = (selectedOptions: Option[]) => { const option = selectedOptions[selectedOptions.length - 1]; if (option.loadChildren) { // 需要保证 selectedOptions 是一个响应式对象,这样才能触发重新渲染 - await option.loadChildren(option); + option.loadChildren(option); } }; @@ -208,8 +208,8 @@ export function Input(props) { } }; - // 弹窗动画的延迟时间是 300 毫秒,动画结束之后再执行,防止动画卡顿 - setTimeout(run, 300); + // 如果没有这个延迟,会导致选择父节点时不展开子节点 + setTimeout(run); }, [variable]); const disabled = props.disabled || form.disabled;