Canvas: Generate graph state out of dodo-app config
Restructure code, create shared config lib.
Change-Id: I2cf06d35c486d4557484daf8618a2c215316fa7e
diff --git a/apps/canvas/front/src/components/actions.tsx b/apps/canvas/front/src/components/actions.tsx
index d4bd5ea..1442b9a 100644
--- a/apps/canvas/front/src/components/actions.tsx
+++ b/apps/canvas/front/src/components/actions.tsx
@@ -1,7 +1,7 @@
-import { AppNode, nodeLabelFull, useEnv, useMessages, useProjectId, useStateStore } from "@/lib/state";
+import { nodeLabelFull, useEnv, useMessages, useProjectId, useStateStore } from "@/lib/state";
import { Button } from "./ui/button";
import { useCallback, useEffect, useState } from "react";
-import { generateDodoConfig } from "@/lib/config";
+import { generateDodoConfig, AppNode } from "config";
import { useNodes, useReactFlow } from "@xyflow/react";
import { useToast } from "@/hooks/use-toast";
import {
@@ -148,9 +148,9 @@
method: "GET",
});
const inst = await resp.json();
- const { x = 0, y = 0, zoom = 1 } = inst.viewport;
- store.setNodes(inst.nodes || []);
- store.setEdges(inst.edges || []);
+ const { x = 0, y = 0, zoom = 1 } = inst.state.viewport;
+ store.setNodes(inst.state.nodes || []);
+ store.setEdges(inst.state.edges || []);
instance.setViewport({ x, y, zoom });
}, [projectId, instance, store]);
const clear = useCallback(() => {