Skip to content

Commit f2bc991

Browse files
authored
Merge pull request #138 from FlowTestAI/small-fixes
fix: mulitple output nodes in the graph should be able to show live d…
2 parents d3b07b0 + 4cb08a3 commit f2bc991

3 files changed

Lines changed: 31 additions & 14 deletions

File tree

src/components/atoms/Editor.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const hideScrollbar = EditorView.theme({
4141
whiteSpace: 'nowrap',
4242
scrollbarWidth: 'none' /* For Firefox */,
4343
},
44+
'&': {
45+
cursor: 'text',
46+
},
4447
});
4548

4649
export const Editor = ({ ...props }) => {

src/components/molecules/flow/graph/Graph.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,14 @@ class Graph {
7373
if (node.type === 'outputNode') {
7474
this.logger.add(LogLevel.INFO, '', { type: 'outputNode', data: { output: prevNodeOutputData } });
7575
if (this.tab) {
76-
const updatedNodes = this.nodes.map((nd) => {
77-
if (nd.id === node.id) {
78-
return {
79-
...nd,
80-
data: {
81-
...nd.data,
82-
output: prevNodeOutputData,
83-
},
84-
};
85-
}
86-
87-
return nd;
88-
});
89-
useTabStore.getState().updateFlowTestNodes(this.tab.id, updatedNodes);
76+
const updatedNode = {
77+
...node,
78+
data: {
79+
...node.data,
80+
output: prevNodeOutputData,
81+
},
82+
};
83+
useTabStore.getState().updateFlowTestNode(this.tab.id, updatedNode);
9084
}
9185
result = {
9286
status: 'Success',

src/stores/TabStore.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ export const useTabStore = create((set, get) => ({
6767
}),
6868
);
6969
},
70+
updateFlowTestNode: (tabId, updatedNode) => {
71+
set(
72+
produce((state) => {
73+
if (tabId) {
74+
const existingTab = state.tabs.find((t) => t.id === tabId);
75+
if (existingTab) {
76+
if (!existingTab.flowDataDraft) {
77+
existingTab.flowDataDraft = existingTab.flowData ? cloneDeep(existingTab.flowData) : {};
78+
}
79+
existingTab.flowDataDraft.nodes = existingTab.flowDataDraft.nodes.map((node, index) => {
80+
if (node.id === updatedNode.id) {
81+
return updatedNode;
82+
}
83+
return node;
84+
});
85+
}
86+
}
87+
}),
88+
);
89+
},
7090
updateFlowTestEdges: (tabId, edges) => {
7191
set(
7292
produce((state) => {

0 commit comments

Comments
 (0)