mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 22:49:53 +00:00
remove dependencies on full_upload_download_graph
This commit is contained in:
@@ -262,10 +262,16 @@
|
||||
(when repo (state/set-db-latest-tx-time! repo))
|
||||
(when-let [conn (state/get-datascript-conn repo)]
|
||||
(try
|
||||
(let [tx-data (edn/read-string tx-data)
|
||||
tx-meta (edn/read-string tx-meta)
|
||||
context (edn/read-string context)
|
||||
_ (state/set-context! context)
|
||||
(let [tx-data (if (string? tx-data)
|
||||
(edn/read-string tx-data)
|
||||
tx-data)
|
||||
tx-meta (if (string? tx-meta)
|
||||
(edn/read-string tx-meta)
|
||||
tx-meta)
|
||||
context (if (string? context)
|
||||
(edn/read-string context)
|
||||
context)
|
||||
_ (when context (state/set-context! context))
|
||||
tx-meta' (if (or (:from-disk? tx-meta) (:new-graph? tx-meta))
|
||||
tx-meta
|
||||
(assoc tx-meta :skip-store? true))
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
(:require [cljs-bean.core :as bean]
|
||||
[frontend.handler.file :as file-handler]
|
||||
[frontend.handler.notification :as notification]
|
||||
[clojure.edn :as edn]))
|
||||
[clojure.edn :as edn]
|
||||
[frontend.state :as state]))
|
||||
|
||||
(defmulti handle identity)
|
||||
|
||||
@@ -13,6 +14,9 @@
|
||||
(defmethod handle :notification [_ data]
|
||||
(apply notification/show! (edn/read-string data)))
|
||||
|
||||
(defmethod handle :add-repo [_ data]
|
||||
(state/add-repo! {:url (:repo (edn/read-string data))}))
|
||||
|
||||
(defmethod handle :default [_ data]
|
||||
(prn :debug "Worker data not handled: " data))
|
||||
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
[frontend.worker.rtc.op-mem-layer :as op-mem-layer]
|
||||
[frontend.worker.rtc.ws :refer [<send!]]
|
||||
[logseq.db.frontend.schema :as db-schema]
|
||||
|
||||
;; TODO:
|
||||
[frontend.persist-db :as persist-db]
|
||||
[frontend.state :as state]))
|
||||
[frontend.worker.state :as state]
|
||||
[promesa.core :as p]
|
||||
[frontend.worker.util :as worker-util]))
|
||||
|
||||
(def transit-r (transit/reader :json))
|
||||
|
||||
@@ -120,11 +119,16 @@
|
||||
(go-try
|
||||
(let [{:keys [t blocks]} all-blocks
|
||||
blocks* (replace-db-id-with-temp-id blocks)
|
||||
blocks-with-page-id (fill-block-fields blocks*)]
|
||||
(<? (p->c (persist-db/<new repo)))
|
||||
(<? (p->c (persist-db/<transact-data repo blocks-with-page-id nil)))
|
||||
(<? (p->c (persist-db/<release-access-handles repo)))
|
||||
(state/add-repo! {:url repo})
|
||||
blocks-with-page-id (fill-block-fields blocks*)
|
||||
^js sqlite @state/*sqlite
|
||||
work (p/do!
|
||||
(.createOrOpenDB sqlite repo)
|
||||
(.exportDB sqlite repo)
|
||||
(.transact repo blocks-with-page-id nil (state/get-context))
|
||||
(.releaseAccessHandles sqlite repo))]
|
||||
(<? (p->c work))
|
||||
|
||||
(worker-util/post-message :add-repo (pr-str {:repo repo}))
|
||||
(op-mem-layer/update-local-tx! repo t))))
|
||||
|
||||
(defn <download-graph
|
||||
|
||||
Reference in New Issue
Block a user