Kaynağa Gözat

don't reload app after importing zip

Tienson Qin 2 hafta önce
ebeveyn
işleme
276c66f0de

+ 8 - 3
src/main/frontend/components/imports.cljs

@@ -66,12 +66,15 @@
                  [".md" ".markdown" ".org" ".js" ".edn" ".css"]))))))))
 
 (defn- finished-cb
-  []
+  [& {:keys [reload?]
+      :or {reload? true}}]
   (notification/show! "Import finished!" :success)
   (shui/dialog-close! :import-indicator)
   (route-handler/redirect-to-home!)
   (if util/web-platform?
-    (js/window.location.reload)
+    (if reload?
+      (js/window.location.reload)
+      (js/setTimeout ui-handler/re-render-root! 500))
     (js/setTimeout ui-handler/re-render-root! 500)))
 
 (defn- lsq-import-handler
@@ -110,7 +113,9 @@
           (notification/show! "Please specify another name as another graph with this name already exists!" :error)
 
           :else
-          (db-import-handler/import-from-sqlite-zip! file graph-name finished-cb)))
+          (db-import-handler/import-from-sqlite-zip! file graph-name
+                                                     (fn []
+                                                       (finished-cb false)))))
 
       (or debug-transit? db-edn?)
       (let [graph-name (string/trim graph-name)]

+ 1 - 3
src/main/frontend/handler/db_based/import.cljs

@@ -170,9 +170,7 @@
                       :warning false))
                    (state/set-state! :graph/importing nil)
                    (state/set-state! :graph/importing-state nil)
-                   (p/delay 2000)
-                   ;; (finished-ok-handler)
-                   )))))))
+                   (finished-ok-handler))))))))
       (p/catch
        (fn [e]
          (js/console.error e)