From 2c5a5048dce1ef2161648ef9fc027aead2c851bf Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 15 Jun 2026 15:18:51 +0200 Subject: [PATCH] Enhance request management by adding functionality to track and cancel associated backend workflows. --- src/App.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index ad335e5..b85bcbe 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -544,13 +544,23 @@ export default function App() { setIsSending(false) }, []) + const attachWorkflowRunToRequest = React.useCallback((controller, runId) => { + if (activeRequestRef.current?.controller !== controller) return + activeRequestRef.current.runId = runId + }, []) + const cancelActiveRequest = React.useCallback(() => { const activeRequest = activeRequestRef.current if (!activeRequest) return activeRequestRef.current = null + if (activeRequest.runId) { + cancelWorkflowRun(backendApiUrl, activeRequest.runId).catch(error => { + console.warn('Workflow cancellation failed', error) + }) + } activeRequest.controller.abort() setIsSending(false) - }, []) + }, [backendApiUrl]) useEffect(() => { return () => {