From 9f2f473cd9de64c55d45c45982e9898e606efe75 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 6 Sep 2022 20:47:11 +0800 Subject: [PATCH] fix: sync not start after binding a local folder to the remote graph --- src/main/frontend/components/file_sync.cljs | 4 +++- src/main/frontend/handler/events.cljs | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/frontend/components/file_sync.cljs b/src/main/frontend/components/file_sync.cljs index 6260b242d5..a1629c3e86 100644 --- a/src/main/frontend/components/file_sync.cljs +++ b/src/main/frontend/components/file_sync.cljs @@ -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 diff --git a/src/main/frontend/handler/events.cljs b/src/main/frontend/handler/events.cljs index d8dadcc4b6..6a1793c069 100644 --- a/src/main/frontend/handler/events.cljs +++ b/src/main/frontend/handler/events.cljs @@ -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)))