فهرست منبع

fix: filter sidebar blocks when switching graphs

close #3743
Tienson Qin 4 سال پیش
والد
کامیت
351b126de7
3فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 1 1
      src/main/frontend/components/right_sidebar.cljs
  2. 1 1
      src/main/frontend/components/sidebar.cljs
  3. 6 0
      src/main/frontend/state.cljs

+ 1 - 1
src/main/frontend/components/right_sidebar.cljs

@@ -249,7 +249,7 @@
 
 
 (rum/defcs sidebar < rum/reactive
 (rum/defcs sidebar < rum/reactive
   [state]
   [state]
-  (let [blocks (state/sub :sidebar/blocks)
+  (let [blocks (state/sub-right-sidebar-blocks)
         blocks (if (empty? blocks)
         blocks (if (empty? blocks)
                  [[(state/get-current-repo) "contents" :contents nil]]
                  [[(state/get-current-repo) "contents" :contents nil]]
                  blocks)
                  blocks)

+ 1 - 1
src/main/frontend/components/sidebar.cljs

@@ -507,7 +507,7 @@
         white? (= "white" (state/sub :ui/theme))
         white? (= "white" (state/sub :ui/theme))
         sidebar-open?  (state/sub :ui/sidebar-open?)
         sidebar-open?  (state/sub :ui/sidebar-open?)
         left-sidebar-open?  (state/sub :ui/left-sidebar-open?)
         left-sidebar-open?  (state/sub :ui/left-sidebar-open?)
-        right-sidebar-blocks (state/sub :sidebar/blocks)
+        right-sidebar-blocks (state/sub-right-sidebar-blocks)
         route-name (get-in route-match [:data :name])
         route-name (get-in route-match [:data :name])
         global-graph-pages? (= :graph route-name)
         global-graph-pages? (= :graph route-name)
         logged? (:name me)
         logged? (:name me)

+ 6 - 0
src/main/frontend/state.cljs

@@ -1622,3 +1622,9 @@
 (defn get-visual-viewport-state
 (defn get-visual-viewport-state
   []
   []
   (:ui/visual-viewport-state @state))
   (:ui/visual-viewport-state @state))
+
+(defn sub-right-sidebar-blocks
+  []
+  (when-let [current-repo (get-current-repo)]
+    (->> (sub :sidebar/blocks)
+         (filter #(= (first %) current-repo)))))