Skip to content

Commit 0476cb4

Browse files
committed
reset current flow run when dropping or pasting a value on a connection
1 parent 6933c6b commit 0476cb4

File tree

1 file changed

+50
-24
lines changed

1 file changed

+50
-24
lines changed

libs/app-canvas/src/app/flow-app.element.tsx

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,30 @@ export class FlowAppElement extends AppElement<NodeInfo> {
270270
const endNode = connection.endNode;
271271
const startNodeThumb = connection.startNodeThumb;
272272

273-
runNodeFromThumb(
274-
startNodeThumb,
275-
canvasApp,
276-
() => {
277-
//
278-
},
279-
this.transformValueForNodeTrigger(text),
280-
endNode,
281-
undefined,
282-
undefined,
283-
this.createRunCounterContext(true, false)
284-
);
273+
let interval: any = undefined;
274+
clearTimeout(interval);
275+
console.log('TRIGGER FLOW!', getIsStopAnimations());
276+
resetRunIndex();
277+
(this.runButton?.domElement as HTMLButtonElement).disabled = false;
278+
setStopAnimations();
279+
// Wait until isStopAnimations is set to false
280+
interval = setInterval(() => {
281+
if (!getIsStopAnimations()) {
282+
clearInterval(interval);
283+
runNodeFromThumb(
284+
startNodeThumb,
285+
canvasApp,
286+
() => {
287+
//
288+
},
289+
this.transformValueForNodeTrigger(text),
290+
endNode,
291+
undefined,
292+
undefined,
293+
this.createRunCounterContext(true, false)
294+
);
295+
}
296+
}, 0);
285297
}
286298
}
287299
});
@@ -2209,21 +2221,35 @@ export class FlowAppElement extends AppElement<NodeInfo> {
22092221
const canvasApp = this.canvasApp;
22102222
const endNode = node.endNode;
22112223
const startNodeThumb = node.startNodeThumb;
2224+
22122225
navigator.clipboard.readText().then((text) => {
22132226
console.log('clipboard', text);
22142227
if (text) {
2215-
runNodeFromThumb(
2216-
startNodeThumb,
2217-
canvasApp,
2218-
() => {
2219-
//
2220-
},
2221-
this.transformValueForNodeTrigger(text),
2222-
endNode,
2223-
undefined,
2224-
undefined,
2225-
this.createRunCounterContext(true, false)
2226-
);
2228+
let interval: any = undefined;
2229+
clearTimeout(interval);
2230+
console.log('TRIGGER FLOW!', getIsStopAnimations());
2231+
resetRunIndex();
2232+
(this.runButton?.domElement as HTMLButtonElement).disabled =
2233+
false;
2234+
setStopAnimations();
2235+
// Wait until isStopAnimations is set to false
2236+
interval = setInterval(() => {
2237+
if (!getIsStopAnimations()) {
2238+
clearInterval(interval);
2239+
runNodeFromThumb(
2240+
startNodeThumb,
2241+
canvasApp,
2242+
() => {
2243+
//
2244+
},
2245+
this.transformValueForNodeTrigger(text),
2246+
endNode,
2247+
undefined,
2248+
undefined,
2249+
this.createRunCounterContext(true, false)
2250+
);
2251+
}
2252+
}, 0);
22272253
}
22282254
});
22292255
return false;

0 commit comments

Comments
 (0)