fix: sync doesn't work after uploading local graph

This commit is contained in:
Tienson Qin
2026-01-29 21:21:45 +08:00
parent 8472d03826
commit ae7a088a3d
2 changed files with 7 additions and 5 deletions

View File

@@ -249,8 +249,7 @@
(p/let [[db search-db client-ops-db :as dbs] (get-dbs repo)
storage (new-sqlite-storage db)
client-ops-storage (when-not @*publishing?
(new-sqlite-storage client-ops-db))
db-based? true]
(new-sqlite-storage client-ops-db))]
(swap! *sqlite-conns assoc repo {:db db
:search search-db
:client-ops client-ops-db})
@@ -287,7 +286,7 @@
(swap! *client-ops-conns assoc repo client-ops-conn)
(when (and (not @*publishing?) (not= client-op/schema-in-db (d/schema @client-ops-conn)))
(d/reset-schema! client-ops-conn client-op/schema-in-db))
(let [initial-tx-report (when (and db-based? (not initial-data-exists?) (not datoms))
(let [initial-tx-report (when (and (not initial-data-exists?) (not datoms))
(let [config (or config "")
initial-data (sqlite-create-graph/build-db-initial-data
config (select-keys opts [:import-type :graph-git-sha]))]

View File

@@ -388,7 +388,9 @@
(fail-fast :db-sync/missing-field
(merge {:repo repo :field field :value value} context))))
(defn- persist-local-tx! [repo normalized-tx-data reversed-datoms _tx-meta]
(defn- persist-local-tx! [repo normalized-tx-data reversed-datoms tx-meta]
(prn :debug :persist-local-tx tx-meta)
(js/console.trace)
(when-let [conn (client-ops-conn repo)]
(let [tx-id (random-uuid)
now (.now js/Date)]
@@ -1044,7 +1046,8 @@
[repo {:keys [tx-data tx-meta] :as tx-report}]
(when (and (enabled?) (seq tx-data)
(not (:rtc-tx? tx-meta))
(:persist-op? tx-meta true))
(:persist-op? tx-meta true)
(ldb/get-graph-rtc-uuid (:db-after tx-report)))
(enqueue-local-tx! repo tx-report)
(when-let [client @worker-state/*db-sync-client]
(when (= repo (:repo client))