fix: sync not start after binding a local folder to the remote graph

This commit is contained in:
Tienson Qin
2022-09-06 20:47:11 +08:00
committed by Andelf
parent ec504fe916
commit 9f2f473cd9
2 changed files with 8 additions and 3 deletions

View File

@@ -367,7 +367,9 @@
(nil? (second info))
(not= (second info) (:GraphUUID graph))))
(if (js/confirm "This directory is not empty, are you sure to sync the remote graph to it? Make sure to back up the directory first.")
(p/resolved nil)
(do
(state/set-state! :graph/remote-binding? true)
(p/resolved nil))
(throw (js/Error. nil)))))))
;; cancel pick a directory

View File

@@ -147,8 +147,11 @@
(graph-switch graph))))
(defmethod handle :graph/switch [[_ graph opts]]
(if @outliner-file/*writes-finished?
(graph-switch-on-persisted graph opts)
(if (or @outliner-file/*writes-finished?
(:graph/remote-binding? @state/state))
(do
(state/set-state! :graph/remote-binding? false)
(graph-switch-on-persisted graph opts))
(notification/show!
"Please wait seconds until all changes are saved for the current graph."
:warning)))