소스 검색

fix: switch to local graph if it exists already

Tienson Qin 1 년 전
부모
커밋
bd7173eaed
2개의 변경된 파일6개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 5
      src/main/frontend/components/repo.cljs
  2. 1 2
      src/main/frontend/handler/db_based/rtc.cljs

+ 5 - 5
src/main/frontend/components/repo.cljs

@@ -46,8 +46,8 @@
 (rum/defc repos-inner
   "Graph list in `All graphs` page"
   [repos]
-  (for [{:keys [url remote? GraphUUID GraphName] :as repo} repos
-        :let [only-cloud? (and remote? (nil? url))
+  (for [{:keys [root url remote? GraphUUID GraphName] :as repo} repos
+        :let [only-cloud? (and remote? (nil? root))
               db-based? (config/db-based-graph? url)]]
     [:div.flex.justify-between.mb-4.items-center {:key (or url GraphUUID)}
      (normalized-graph-label repo #(if only-cloud?
@@ -195,12 +195,12 @@
                                                                  (not (and rtc-graph? remote?)))
                                                           (state/pub-event! [:graph/open-new-window url])
                                                           (cond
+                                                            (:root graph) ; exists locally
+                                                            (state/pub-event! [:graph/switch url])
+
                                                             (and rtc-graph? remote?)
                                                             (state/pub-event! [:rtc/download-remote-graph GraphName GraphUUID])
 
-                                                            (or local? db-only?)
-                                                            (state/pub-event! [:graph/switch url])
-
                                                             :else
                                                             (state/pub-event! [:graph/pull-down-remote-graph graph])))))}})))
                     switch-repos)

+ 1 - 2
src/main/frontend/handler/db_based/rtc.cljs

@@ -62,8 +62,7 @@
          (p/let [result (.rtc-get-graphs worker repo token)
                  graphs (bean/->clj result)
                  result (->> graphs
-                             (remove (fn [graph]
-                                       (= (:graph-status graph) "deleting")))
+                             (remove (fn [graph] (= (:graph-status graph) "deleting")))
                              (mapv (fn [graph]
                                      (merge
                                       (let [url (str config/db-version-prefix (:graph-name graph))]