From ca672e4dc11d4e706b2a6d84a4bd2f1da7904e2c Mon Sep 17 00:00:00 2001
From: Maximilian Giller <m.giller@tu-bs.de>
Date: Thu, 1 Sep 2022 16:33:08 +0200
Subject: [PATCH] Hooked initial loading of graph to Mount-Hook

---
 src/editor/js/components/editor.tsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/editor/js/components/editor.tsx b/src/editor/js/components/editor.tsx
index 5821fde..cbabc02 100644
--- a/src/editor/js/components/editor.tsx
+++ b/src/editor/js/components/editor.tsx
@@ -12,7 +12,9 @@ import { Link } from "../structures/graph/link";
 import { NodeTypesEditor } from "./nodetypeseditor";
 import { SpaceManager } from "./spacemanager";
 
-type propTypes = any;
+type propTypes = {
+    spaceId: string;
+};
 type stateTypes = {
     graph: Graph;
     visibleLabels: boolean;
@@ -72,9 +74,13 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
             keys: {},
             graphWidth: 1000,
         };
+    }
 
-        // Load initial space
-        this.loadSpace("space");
+    componentDidMount() {
+        if (this.props.spaceId !== undefined) {
+            // Load initial space
+            this.loadSpace(this.props.spaceId);
+        }
     }
 
     /**
-- 
GitLab