修复组件面板展开状态重置
仅在组件存在性发生变化时同步展开状态,避免深拷贝更新意外重新展开。
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ export function ComponentPanel(props: ComponentPanelProps) {
|
||||
useEffect(() => {
|
||||
const previous = previousComponentRef.current;
|
||||
previousComponentRef.current = component;
|
||||
if (component !== previous) {
|
||||
if (Boolean(component) !== Boolean(previous)) {
|
||||
setExpanded(Boolean(component));
|
||||
}
|
||||
}, [component]);
|
||||
|
||||
Reference in New Issue
Block a user