Procházet zdrojové kódy

fix: filter sidebar blocks when switching graphs

close #3743
Tienson Qin před 4 roky
rodič
revize
351b126de7

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

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

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

@@ -507,7 +507,7 @@
         white? (= "white" (state/sub :ui/theme))
         sidebar-open?  (state/sub :ui/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])
         global-graph-pages? (= :graph route-name)
         logged? (:name me)

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

@@ -1622,3 +1622,9 @@
 (defn get-visual-viewport-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)))))