fix: <sync-start returns a channel

This commit is contained in:
Tienson Qin
2022-11-06 20:12:39 +08:00
parent 530f683ac0
commit 865ba9c69c
4 changed files with 10 additions and 10 deletions

View File

@@ -132,7 +132,7 @@
(do
(state/set-state! [:ui/loading? :graph/create-remote?] true)
(when-let [GraphUUID (get (async/<! (file-sync-handler/create-graph graph-name)) 2)]
(async/<! (fs-sync/sync-start))
(async/<! (fs-sync/<sync-start))
(state/set-state! [:ui/loading? :graph/create-remote?] false)
;; update existing repo
(state/set-repos! (map (fn [r]
@@ -376,7 +376,7 @@
(second @graphs-txid)
(fs-sync/graph-sync-off? (second @graphs-txid))
(async/<! (fs-sync/<check-remote-graph-exists (second @graphs-txid))))
(fs-sync/sync-start)
(fs-sync/<sync-start)
;; remote graph already has been deleted, clear repos first, then create-remote-graph
synced-file-graph? ; <check-remote-graph-exists -> false

View File

@@ -49,7 +49,7 @@
(display-welcome-message)
(persist-var/load-vars)
(when config/dev?
(js/setTimeout #(sync/sync-start) 1000))))
(js/setTimeout #(sync/<sync-start) 1000))))
(defn ^:export init []
;; init is called ONCE when the page loads

View File

@@ -3000,11 +3000,11 @@
(declare network-online-cursor)
(defn sync-start
(defn <sync-start
[]
(when (false? @*sync-entered?)
(reset! *sync-entered? true)
(go
(go
(when (false? @*sync-entered?)
(reset! *sync-entered? true)
(let [*sync-state (atom (sync-state))
current-user-uuid (user/user-uuid)
;; put @graph-uuid & get-current-repo together,
@@ -3056,7 +3056,7 @@
(<sync-stop)
(and (false? o) (true? n))
(sync-start)
(<sync-start)
:else
nil)))

View File

@@ -67,7 +67,7 @@
(defn- file-sync-restart! []
(async/go (async/<! (p->c (persist-var/load-vars)))
(async/<! (sync/<sync-stop))
(some-> (sync/sync-start) async/<!)))
(some-> (sync/<sync-start) async/<!)))
(defn- file-sync-stop! []
(async/go (async/<! (p->c (persist-var/load-vars)))
@@ -93,7 +93,7 @@
(vector? (:sync-meta %))
(util/uuid-string? (first (:sync-meta %)))
(util/uuid-string? (second (:sync-meta %)))) repos)
(sync/sync-start)))))
(sync/<sync-start)))))
(ui-handler/re-render-root!)
(file-sync/maybe-onboarding-show status)))))))