diff --git a/frontend/src/components/tree_editor/DiagramVisualizer.tsx b/frontend/src/components/tree_editor/DiagramVisualizer.tsx
index 39107fade..e1f8d3098 100644
--- a/frontend/src/components/tree_editor/DiagramVisualizer.tsx
+++ b/frontend/src/components/tree_editor/DiagramVisualizer.tsx
@@ -72,6 +72,7 @@ const setStatusNode = (
const DiagramVisualizer = memo(
({
modelJson,
+ setResultJson,
manager,
treeStructure,
view,
@@ -79,6 +80,7 @@ const DiagramVisualizer = memo(
setGoBack,
}: {
modelJson: any;
+ setResultJson: Function;
manager: any;
treeStructure: any;
view: any;
@@ -115,6 +117,12 @@ const DiagramVisualizer = memo(
engine.current.zoomToFitNodes({ margin: 50 });
};
+ // Fixes uncomplete first serialization
+ setTimeout(() => {
+ console.log("Rendered!");
+ setResultJson(model.current.serialize())
+ }, 1);
+
return (
{
+ if (view === TreeViewType.Visualizer) {
+ return
+ }
try {
await saveSubtree(previousResultJson, projectName, previousName);
} catch (error: unknown) {
@@ -112,16 +115,17 @@ const MainTreeEditorContainer = ({
setWentBack(false);
// Fetch the new subtree or project graph
- getBTTree();
+ // getBTTree();
fetchTree();
console.log("Getting graph!");
- }, [projectName, subTreeName, view]);
+ }, [projectName, subTreeName]);
useEffect(() => {
if (goBack) {
saveSubtreeJson(resultJson, subTreeName); // Save the current subtree
setTreeHierarchy((prevHierarchy) => {
const newHierarchy = prevHierarchy.slice(0, -1);
+ console.log("SET")
setSubTreeName(newHierarchy[newHierarchy.length - 1] || "");
return newHierarchy;
});
@@ -135,11 +139,11 @@ const MainTreeEditorContainer = ({
console.log("Updated Subtree hierarchy: ", treeHierarchy);
}, [treeHierarchy]);
- // useEffect(() => {
- // setInitialJson(modelJson);
- // getBTTree();
- // console.log("Changing view!");
- // }, [view]);
+ useEffect(() => {
+ // fetchTree();
+ getBTTree();
+ console.log("Changing view!");
+ }, [view]);
return (
diff --git a/frontend/src/components/tree_editor/NodeMenu.tsx b/frontend/src/components/tree_editor/NodeMenu.tsx
index bf38b0997..c599aec87 100644
--- a/frontend/src/components/tree_editor/NodeMenu.tsx
+++ b/frontend/src/components/tree_editor/NodeMenu.tsx
@@ -1,6 +1,5 @@
import React, { MouseEventHandler, useEffect, useState } from "react";
import "./NodeMenu.css";
-import axios from "axios";
import { ReactComponent as DeleteIcon } from "./img/del_node.svg";
import { ReactComponent as SubtreeIcon } from "./img/subtree.svg";
diff --git a/frontend/src/components/tree_editor/TreeEditor.tsx b/frontend/src/components/tree_editor/TreeEditor.tsx
index 3bb9f264d..27c0649c3 100644
--- a/frontend/src/components/tree_editor/TreeEditor.tsx
+++ b/frontend/src/components/tree_editor/TreeEditor.tsx
@@ -128,6 +128,7 @@ const TreeEditor = memo(
{view === TreeViewType.Visualizer ? (