Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): sync flowVersion to URL when loading graph from Library (#11585)

Abhimanyu Yadav7edf01777e36
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/useFlow.ts b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/useFlow.ts
index 64f00871d8..bf0ebf0a97 100644
--- a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/useFlow.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/useFlow.ts
@@ -42,11 +42,12 @@ export const useFlow = () => {
const setBlockMenuOpen = useControlPanelStore(
useShallow((state) => state.setBlockMenuOpen),
);
- const [{ flowID, flowVersion, flowExecutionID }] = useQueryStates({
- flowID: parseAsString,
- flowVersion: parseAsInteger,
- flowExecutionID: parseAsString,
- });
+ const [{ flowID, flowVersion, flowExecutionID }, setQueryStates] =
+ useQueryStates({
+ flowID: parseAsString,
+ flowVersion: parseAsInteger,
+ flowExecutionID: parseAsString,
+ });
const { data: executionDetails } = useGetV1GetExecutionDetails(
flowID || "",
@@ -102,6 +103,9 @@ export const useFlow = () => {
// load graph schemas
useEffect(() => {
if (graph) {
+ setQueryStates({
+ flowVersion: graph.version ?? 1,
+ });
setGraphSchemas(
graph.input_schema as Record<string, any> | null,
graph.credentials_input_schema as Record<string, any> | null,