Browse Source

fix: quit loading if creating remote graph failed

Tienson Qin 3 years ago
parent
commit
358c352e27
1 changed files with 15 additions and 13 deletions
  1. 15 13
      src/main/frontend/handler/file_sync.cljs

+ 15 - 13
src/main/frontend/handler/file_sync.cljs

@@ -44,19 +44,21 @@
         (let [tx-info [0 r (user/user-uuid) (state/get-current-repo)]]
           (apply sync/update-graphs-txid! tx-info)
           (swap! refresh-file-sync-component not) tx-info)
-        (cond
-          ;; already processed this exception by events
-          ;; - :file-sync/storage-exceed-limit
-          ;; - :file-sync/graph-count-exceed-limit
-          (or (sync/storage-exceed-limit? r)
-              (sync/graph-count-exceed-limit? r))
-          nil
-
-          (contains? #{400 404} (get-in (ex-data r) [:err :status]))
-          (notification/show! (str "Create graph failed: already existed graph: " name) :warning true nil 4000)
-
-          :else
-          (notification/show! (str "Create graph failed:" r) :warning true nil 4000))))))
+        (do
+          (state/set-state! [:ui/loading? :graph/create-remote?] false)
+          (cond
+           ;; already processed this exception by events
+           ;; - :file-sync/storage-exceed-limit
+           ;; - :file-sync/graph-count-exceed-limit
+           (or (sync/storage-exceed-limit? r)
+               (sync/graph-count-exceed-limit? r))
+           nil
+
+           (contains? #{400 404} (get-in (ex-data r) [:err :status]))
+           (notification/show! (str "Create graph failed: already existed graph: " name) :warning true nil 4000)
+
+           :else
+           (notification/show! (str "Create graph failed:" r) :warning true nil 4000)))))))
 
 (defn <delete-graph
   [graph-uuid]