From 76b271920d586ee1b46613bb59d72f7c707cc822 Mon Sep 17 00:00:00 2001
From: "BCOM\\nchambron" <nathan.chambron@b-com.com>
Date: Mon, 12 Sep 2022 16:28:46 +0200
Subject: [PATCH] fix: remove graph when selecting unreachable server

---
 .../Editor/Windows/WorldGraphWindow.cs                    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs
index 5e996fc..867c758 100644
--- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs	
+++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs	
@@ -47,9 +47,13 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows
         public static void ShowWindowFromWorldStorageWindow(WorldStorageServer server, WorldStorageUser user)
         {
             var window = GetWindow<WorldGraphWindow>("Graph Editor", true, typeof(SceneView));
-            if (window.myGraph != null && window.myGraph.ServerAndLocalDifferent() && EditorUtility.DisplayDialog("Saving node positions", "The World Graph has been modified. \nWould you like to push the modifications to the server ?", "Yes", "No"))
+            if (window.myGraph != null)
             {
-                window.myGraph.SaveInServer();
+                if (window.myGraph.ServerAndLocalDifferent() && EditorUtility.DisplayDialog("Saving node positions", "The World Graph has been modified. \nWould you like to push the modifications to the server ?", "Yes", "No"))
+                {
+                    window.myGraph.SaveInServer();
+                }
+                window.rootVisualElement.Remove(window.myGraph);
             }
             GraphEditorWindow.ResetWindow();
             window.worldStorageServer = server;
-- 
GitLab