Pārlūkot izejas kodu

fix: can't import debug transit

Tienson Qin 6 mēneši atpakaļ
vecāks
revīzija
2f7189f769
1 mainītis faili ar 7 papildinājumiem un 5 dzēšanām
  1. 7 5
      src/main/frontend/worker/db_worker.cljs

+ 7 - 5
src/main/frontend/worker/db_worker.cljs

@@ -885,11 +885,13 @@
                                 (= :thread-api/create-or-open-db method-k)
                                 ;; because shared-service operates at the graph level,
                                 ;; creating a new database or switching to another one requires re-initializing the service.
-                                (p/let [method-args (ldb/read-transit-str (last args))
-                                        service (<init-service! (first method-args))]
-                                  ;; wait for service ready
-                                  (get-in service [:status :ready])
-                                  (js-invoke (:proxy service) k args))
+                                (let [[graph opts] (ldb/read-transit-str (last args))]
+                                  (if (:import-type opts)
+                                    (start-db! graph opts)
+                                    (p/let [service (<init-service! graph)]
+                                      (get-in service [:status :ready])
+                                      ;; wait for service ready
+                                      (js-invoke (:proxy service) k args))))
 
                                 (or (contains? #{:thread-api/sync-app-state} method-k)
                                     (nil? service))