From 057a02c90cb5d5dfd3c0e735f350fbb8d58bb229 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Wed, 14 Jun 2023 20:02:38 -0300 Subject: [PATCH] fit view --- src/frontend/src/contexts/tabsContext.tsx | 1 + .../src/pages/FlowPage/components/PageComponent/index.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 4081b7b33..6662a0781 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -21,6 +21,7 @@ import { downloadFlowsFromDatabase, uploadFlowsToDatabase, } from "../controllers/API"; +import _ from "lodash"; const uid = new ShortUniqueId({ length: 5 }); diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 18aca8fe3..c27e8d64e 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -127,6 +127,7 @@ export default function Page({ flow }: { flow: FlowType }) { setEdges(flow?.data?.edges ?? []); if (reactFlowInstance) { setViewport(flow?.data?.viewport ?? { x: 1, y: 0, zoom: 0.5 }); + reactFlowInstance.fitView(); } }, [flow, reactFlowInstance, setEdges, setNodes, setViewport]); //set extra sidebar