fix(frontend): Fix Run/Stop button on Builder page refresh (#9503)

When opened graph is running and Builder page is refreshed the bottom
says `Run` but should show `Stop` instead.

### Changes 🏗️

- Fix state on refresh, so that the bottom button is `Stop` if graph is
currently running

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Refresh still retrieves past and ongoing execution updates
- [x] Bottom Builder button says `Stop` when page is refreshed and graph
is running
  - [x] `Stop` button works and terminates execution
This commit is contained in:
Krzysztof Czerwinski
2025-02-21 14:09:05 +01:00
committed by GitHub
parent a692eedb1c
commit 70d095ba98
2 changed files with 10 additions and 1 deletions

View File

@@ -610,6 +610,16 @@ export default function useAgentGraph(
flowID,
flowExecutionID,
);
if (
(execution.status === "QUEUED" || execution.status === "RUNNING") &&
saveRunRequest.request === "none"
) {
setSaveRunRequest({
request: "run",
state: "running",
activeExecutionID: flowExecutionID,
});
}
setUpdateQueue((prev) => [...prev, ...execution.node_executions]);
// Track execution until completed

View File

@@ -41,7 +41,6 @@ import {
} from "./types";
import { createBrowserClient } from "@supabase/ssr";
import getServerSupabase from "../supabase/getServerSupabase";
import { filter } from "../../../test-runner-jest.config";
const isClient = typeof window !== "undefined";