From 9b8ee45c87588c16337d2b1c3cff1fc52aec1571 Mon Sep 17 00:00:00 2001
From: Mike Greiling <mike@pixelcog.com>
Date: Fri, 2 Sep 2016 20:23:35 -0500
Subject: [PATCH] sync sidebar DOM state on page:change to minimize
 split-second appearance of the sidebar in certain situations

---
 app/assets/javascripts/sidebar.js.es6 | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6
index 0cd6f946f61..755fac8107b 100644
--- a/app/assets/javascripts/sidebar.js.es6
+++ b/app/assets/javascripts/sidebar.js.es6
@@ -23,8 +23,6 @@
       if (!singleton) {
         singleton = this;
         singleton.init();
-      } else {
-        singleton.renderState();
       }
       return singleton;
     }
@@ -38,7 +36,8 @@
       $(document)
         .on('click', sidebarToggleSelector, () => this.toggleSidebar())
         .on('click', pinnedToggleSelector, () => this.togglePinnedState())
-        .on('click', 'html, body', (e) => this.handleClickEvent(e));
+        .on('click', 'html, body', (e) => this.handleClickEvent(e))
+        .on('page:change', () => this.renderState());
       this.renderState();
     }
 
-- 
GitLab