1
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
8612f8245d

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

@@ -349,10 +349,15 @@
                         (when db-based? (db-persist/delete-graph! url))
                         (search/remove-db! url)
                         (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)))]
-                            (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)
               db-based?
               (config/demo-graph? url))