Browse Source

revert initial sidebar state changes

Konstantinos Kaloutas 2 years ago
parent
commit
09476eff27
2 changed files with 5 additions and 12 deletions
  1. 3 0
      src/main/frontend/components/right_sidebar.cljs
  2. 2 12
      src/main/frontend/state.cljs

+ 3 - 0
src/main/frontend/components/right_sidebar.cljs

@@ -427,6 +427,9 @@
 (rum/defcs sidebar < rum/reactive
   [state]
   (let [blocks (state/sub-right-sidebar-blocks)
+        blocks (if (empty? blocks)
+                 [[(state/get-current-repo) "contents" :contents nil]]
+                 blocks)
         sidebar-open? (state/sub :ui/sidebar-open?)
         width (state/sub :ui/sidebar-width)
         repo (state/sub :git/current-repo)]

+ 2 - 12
src/main/frontend/state.cljs

@@ -1069,21 +1069,11 @@ Similar to re-frame subscriptions"
 
 (defn toggle-sidebar-open?!
   []
-  (let [current-repo (get-current-repo)
-        blocks (filter #(= (first %) current-repo) (:sidebar/blocks @state))]
-    (when (and (not (:ui/sidebar-open? @state)) (empty? blocks))
-      (swap! state assoc :sidebar/blocks [[current-repo "contents" :contents nil]])
-      (set-state! [:ui/sidebar-collapsed-blocks "contents"] false))
-    (swap! state update :ui/sidebar-open? not)))
+  (swap! state update :ui/sidebar-open? not))
 
 (defn open-right-sidebar!
   []
-  (let [current-repo (get-current-repo)
-        blocks (filter #(= (first %) current-repo) (:sidebar/blocks @state))]
-    (when (empty? blocks)
-      (swap! state assoc :sidebar/blocks [[current-repo "contents" :contents nil]])
-      (set-state! [:ui/sidebar-collapsed-blocks "contents"] false))
-    (swap! state assoc :ui/sidebar-open? true)))
+  (swap! state assoc :ui/sidebar-open? true))
 
 (defn hide-right-sidebar!
   []