Просмотр исходного кода

fix: load home page correctly after import

Previously it worked for one journal page but with multiple journal
pages the latest journal page loaded incorrectly
Gabriel Horner 2 лет назад
Родитель
Сommit
ce37f4777e
2 измененных файлов с 3 добавлено и 5 удалено
  1. 2 4
      src/main/frontend/components/imports.cljs
  2. 1 1
      src/main/frontend/handler/repo.cljs

+ 2 - 4
src/main/frontend/components/imports.cljs

@@ -4,7 +4,6 @@
             [clojure.core.async :as async]
             [clojure.edn :as edn]
             [clojure.string :as string]
-            [datascript.core :as d]
             [frontend.components.onboarding.setups :as setups]
             [frontend.components.repo :as repo]
             [frontend.components.svg :as svg]
@@ -269,9 +268,8 @@
                                 (async/<! (p->c (import-config-file! config-file)))
                                 (async/<! (import-from-asset-files! asset-files))
                                 (async/<! (import-from-doc-files! db-conn doc-files))
-                                                                                   ;; Go to home
-                                (route-handler/redirect-to-home!)
-                                (state/set-state! :graph/importing nil)))))]
+                                (state/set-state! :graph/importing nil)
+                                (finished-cb)))))]
     (state/set-modal!
      #(confirm-graph-name-dialog original-graph-name
                                  (fn [graph-name]

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

@@ -526,7 +526,7 @@
            _ (op-mem-layer/<init-load-from-indexeddb! full-graph-name)
            _ (start-repo-db-if-not-exists! full-graph-name)
            _ (state/add-repo! {:url full-graph-name})
-           _ (route-handler/redirect-to-home!)
+           _ (when-not file-graph-import? (route-handler/redirect-to-home!))
            initial-data (sqlite-create-graph/build-db-initial-data config/config-default-content)
            _ (db/transact! full-graph-name initial-data)
            _ (repo-config-handler/set-repo-config-state! full-graph-name config/config-default-content)