Skip to content

Commit 90a99f4

Browse files
committed
Show proper flow name in complex node
1 parent 6fd9b28 commit 90a99f4

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/components/molecules/flow/nodes/ComplexNode.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Tippy from '@tippyjs/react';
88
import 'tippy.js/dist/tippy.css';
99

1010
const ComplexNode = ({ id, data }) => {
11-
const [selectedValue, setSelectedValue] = useState('');
1211
const { ipcRenderer } = window;
1312

1413
const setFlowForComplexNode = useCanvasStore((state) => state.setFlowForComplexNode);
@@ -18,13 +17,9 @@ const ComplexNode = ({ id, data }) => {
1817
return ipcRenderer.relative(collection.pathname, fullPath);
1918
});
2019

21-
const setFlow = (relativePath) => {
22-
setFlowForComplexNode(id, relativePath);
23-
};
24-
2520
if (data.relativePath) {
2621
if (!flowTests.find((f) => f === data.relativePath)) {
27-
setFlow('');
22+
setFlowForComplexNode(id, '');
2823
}
2924
}
3025

@@ -37,12 +32,15 @@ const ComplexNode = ({ id, data }) => {
3732
handleRightData={{ type: 'source' }}
3833
>
3934
<div>
40-
<Tippy content={selectedValue !== '' ? selectedValue : 'Select a flow'} placement='top' maxWidth='none'>
35+
<Tippy
36+
content={data.relativePath && data.relativePath !== '' ? data.relativePath : 'Select a flow'}
37+
placement='top'
38+
maxWidth='none'
39+
>
4140
<select
4241
onChange={(event) => {
4342
const value = event.target?.value;
44-
setFlow(value);
45-
setSelectedValue(value);
43+
setFlowForComplexNode(id, value);
4644
}}
4745
name='flow'
4846
value={data.relativePath ? data.relativePath : ''}

0 commit comments

Comments
 (0)