@@ -11,7 +11,7 @@ import setVarNode from './compute/setvarnode';
1111import { LogLevel } from './GraphLogger' ;
1212
1313class Graph {
14- constructor ( nodes , edges , startTime , initialEnvVars , logger ) {
14+ constructor ( nodes , edges , startTime , initialEnvVars , logger , caller ) {
1515 this . nodes = nodes ;
1616 this . edges = edges ;
1717 this . logger = logger ;
@@ -20,6 +20,7 @@ class Graph {
2020 this . graphRunNodeOutput = { } ;
2121 this . auth = undefined ;
2222 this . envVariables = initialEnvVars ;
23+ this . caller = caller ;
2324 }
2425
2526 #checkTimeout( ) {
@@ -70,7 +71,9 @@ class Graph {
7071 if ( node . type === 'outputNode' ) {
7172 //this.logs.push(`Output: ${JSON.stringify(prevNodeOutputData)}`);
7273 this . logger . add ( LogLevel . INFO , '' , { type : 'outputNode' , data : prevNodeOutputData } ) ;
73- useCanvasStore . getState ( ) . setOutputNode ( node . id , prevNodeOutputData ) ;
74+ if ( this . caller === 'main' ) {
75+ useCanvasStore . getState ( ) . setOutputNode ( node . id , prevNodeOutputData ) ;
76+ }
7477 result = {
7578 status : 'Success' ,
7679 data : prevNodeOutputData ,
@@ -141,6 +144,7 @@ class Graph {
141144 this . startTime ,
142145 this . envVariables ,
143146 this . logger ,
147+ node . type ,
144148 ) ;
145149 result = await cNode . evaluate ( ) ;
146150 this . envVariables = result . envVars ;
@@ -208,11 +212,13 @@ class Graph {
208212
209213 async run ( ) {
210214 // reset every output node for a fresh run
211- this . nodes . forEach ( ( node ) => {
212- if ( node . type === 'outputNode' ) {
213- useCanvasStore . getState ( ) . unSetOutputNode ( node . id ) ;
214- }
215- } ) ;
215+ if ( this . caller === 'main' ) {
216+ this . nodes . forEach ( ( node ) => {
217+ if ( node . type === 'outputNode' ) {
218+ useCanvasStore . getState ( ) . unSetOutputNode ( node . id ) ;
219+ }
220+ } ) ;
221+ }
216222 this . graphRunNodeOutput = { } ;
217223
218224 this . logger . add ( LogLevel . INFO , 'Start Flowtest' ) ;
0 commit comments