@@ -63,31 +63,16 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
6363 const activeNode = useMemo ( ( ) => {
6464 const node = nodes . find ( ( r ) => r . id === id ) ;
6565 return node || { } ;
66- } , [ nodes ] ) ;
66+ } , [ JSON . stringify ( nodes ) , id ] ) ;
6767
68- const titleRef = useRef ( null ) ;
69- const descRef = useRef ( null ) ;
70-
71- const titleText = activeNode . data ?. title || nodeSetting ?. title ;
68+ const titleText = activeNode . data ?. title ;
7269 const descText = activeNode . data ?. desc ;
7370
7471 const { nodePanel, iconSvg, showTestingBtn } = nodeSetting ;
7572 const SVGWidget = widgets [ nodeSetting ?. iconSvg ]
7673 const hideDesc = nodePanel ?. hideDesc ?? globalConfig ?. nodePanel ?. hideDesc ?? false ;
7774 const isShowStatusPanel = Boolean ( isTruthy ( node ?. _status ) && openLogPanel ) ;
7875 const offsetRightStatus = isNumber ( logPanel ?. width ) ? Number ( logPanel ?. width + 10 ) : 410 ;
79-
80- // useEffect(() => {
81- // if (titleRef?.current?.input && titleRef?.current?.input?.value !== activeNode.data?.title) {
82- // titleRef.current.input.value = activeNode.data?.title;
83- // }
84- // }, [activeNode.data?.title]);
85-
86- // useEffect(() => {
87- // if (descRef?.current?.input && descRef?.current?.input?.value !== activeNode.data?.desc) {
88- // descRef.current.input.value = activeNode.data?.desc;
89- // }
90- // }, [activeNode.data?.desc]);
9176
9277 const handleTitleChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
9378 handleNodeValueChange ( { title : e . target . value } ) ;
@@ -161,14 +146,14 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
161146 ) }
162147 </ span >
163148 { disabled || readOnly ? (
164- < TextEllipsis text = { titleText } style = { { marginLeft : '11px' } } />
149+ < TextEllipsis text = { titleText || nodeSetting ?. title } style = { { marginLeft : '11px' } } />
165150 ) : (
166151 < Input
167- ref = { titleRef }
168152 size = "small"
169153 style = { { width : '100%' } }
170154 value = { titleText }
171155 onChange = { handleTitleChange }
156+ placeholder = { nodeSetting ?. title }
172157 />
173158 ) }
174159 </ div >
@@ -180,7 +165,7 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
180165 type = "icon-yunhang"
181166 onClick = { ( ) => {
182167 const n =
183- nodes ?. find ( item => item ?. id === node ?. id ) || { } ;
168+ nodes ?. find ( ( item : any ) => item ?. id === node ?. id ) || { } ;
184169 onTesting && onTesting ( n , nodes ) ;
185170 } }
186171 style = { { fontSize : 16 } }
@@ -210,7 +195,6 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
210195 )
211196 ) : (
212197 < Input . TextArea
213- ref = { descRef }
214198 placeholder = "添加描述..."
215199 autoSize = { { minRows : 1 , maxRows : 3 } }
216200 value = { descText }
0 commit comments