Browse Source

fix: without a repo url

Peng Xiao 3 years ago
parent
commit
f8d911d591
2 changed files with 7 additions and 5 deletions
  1. 1 1
      src/main/frontend/components/repo.cljs
  2. 6 4
      src/main/frontend/handler/ui.cljs

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

@@ -206,7 +206,7 @@
                          :options {:class "ml-1"
                                    :on-click (fn [e]
                                                (if (gobj/get e "shiftKey")
-                                                 (ui-handler/open-new-window! url)
+                                                 (ui-handler/open-new-window! e url)
                                                  (state/pub-event! [:graph/switch url])))}}))
                     switch-repos)
         refresh-link (let [nfs-repo? (config/local-db? current-repo)]

+ 6 - 4
src/main/frontend/handler/ui.cljs

@@ -301,7 +301,9 @@
     (state/pub-event! [:modal/show-cards])))
 
 (defn open-new-window!
-  [repo]
-  ; TODO: find out a better way to open a new window with a different repo path
-  (when repo (storage/set :git/current-repo repo))
-  (ipc/ipc "openNewWindow"))
+  ([_e]
+   (open-new-window! _e nil))
+  ([_e repo]
+   ; TODO: find out a better way to open a new window with a different repo path
+   (when (string? repo) (storage/set :git/current-repo repo))
+   (ipc/ipc "openNewWindow")))