From f862ed1403bd5ddf3f5ddf35461410f751912088 Mon Sep 17 00:00:00 2001
From: Danila Fedorin <danila.fedorin@gmail.com>
Date: Wed, 25 Aug 2021 15:06:13 -0700
Subject: [PATCH] Hide links when opening policy, show policy when navigated
 after load

---
 src/RootViewModel.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/RootViewModel.js b/src/RootViewModel.js
index 6c05cc9..2063790 100644
--- a/src/RootViewModel.js
+++ b/src/RootViewModel.js
@@ -50,13 +50,22 @@ export class RootViewModel extends ViewModel {
         this.emitChange();
     }
 
+    _hideLinks() {
+        this.link = null;
+        this.openLinkViewModel = null;
+        this.createLinkViewModel = null;
+    }
+
     updateHash(hash) {
         if (hash.startsWith("#/policy/")) {
             const server = hash.substr(9);
+            this._hideLinks();
             this.loadServerPolicyViewModel = new LoadServerPolicyViewModel(this.childOptions({server}));
             this.loadServerPolicyViewModel.load();
+            this.emitChange();
         } else {
             const oldLink = this.link;
+            this.loadServerPolicyViewModel = null;
             this.link = Link.parse(hash);
             this._updateChildVMs(oldLink);
         }
-- 
GitLab