浏览代码

fix: display more notice when re-routing after graph deletion

If left sidebar is collapsed, there's no indication of what graph you
are on so we should at least notify user so it's explained and
not seemingly buggy
Gabriel Horner 1 年之前
父节点
当前提交
8612f8245d
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      src/main/frontend/handler/repo.cljs

+ 8 - 3
src/main/frontend/handler/repo.cljs

@@ -349,10 +349,15 @@
                         (when db-based? (db-persist/delete-graph! url))
                         (when db-based? (db-persist/delete-graph! url))
                         (search/remove-db! url)
                         (search/remove-db! url)
                         (state/delete-repo! repo)
                         (state/delete-repo! repo)
-                        (notification/show! (str "Removed graph " (pr-str (text-util/get-graph-name-from-path url))) :success)
-                        (when (= current-repo url)
+                        (if (= current-repo url)
                           (when-let [graph (:url (first (state/get-repos)))]
                           (when-let [graph (:url (first (state/get-repos)))]
-                            (state/pub-event! [:graph/switch graph {:persist? false}])))))]
+                            (notification/show! (str "Removed graph "
+                                                     (pr-str (text-util/get-graph-name-from-path url))
+                                                     ". Redirecting to graph "
+                                                     (pr-str (text-util/get-graph-name-from-path url)))
+                                                :success)
+                            (state/pub-event! [:graph/switch graph {:persist? false}]))
+                          (notification/show! (str "Removed graph " (pr-str (text-util/get-graph-name-from-path url))) :success))))]
     (when (or (config/local-file-based-graph? url)
     (when (or (config/local-file-based-graph? url)
               db-based?
               db-based?
               (config/demo-graph? url))
               (config/demo-graph? url))