diff --git a/src/main/frontend/handler/events.cljs b/src/main/frontend/handler/events.cljs index 57edcfdae..60f5bb080 100644 --- a/src/main/frontend/handler/events.cljs +++ b/src/main/frontend/handler/events.cljs @@ -187,11 +187,13 @@ ;; Parameters for the `persist-db` function, to show the notification messages (defn- graph-switch-on-persisted "graph: the target graph to switch to" - [graph _opts] + [graph opts] (p/do! - (repo-handler/restore-and-setup-repo! graph) - (graph-switch graph) - (state/set-state! :sync-graph/init? false))) + (repo-handler/restore-and-setup-repo! graph) + (graph-switch graph) + (state/set-state! :sync-graph/init? false) + (when (:rtc-download? opts) + (and (search-handler/rebuild-indices!) true)))) (defmethod handle :graph/switch [[_ graph opts]] (state/set-state! :db/async-queries #{}) diff --git a/src/main/frontend/handler/worker.cljs b/src/main/frontend/handler/worker.cljs index bdaac9bc5..603ae62fc 100644 --- a/src/main/frontend/handler/worker.cljs +++ b/src/main/frontend/handler/worker.cljs @@ -5,7 +5,6 @@ [frontend.handler.notification :as notification] [frontend.state :as state] [promesa.core :as p] - [frontend.util :as util] [logseq.db :as ldb])) (defmulti handle identity) @@ -28,7 +27,7 @@ (defmethod handle :add-repo [_ _worker data] (state/add-repo! {:url (:repo data)}) - (state/pub-event! [:graph/switch (:repo data) {}])) + (state/pub-event! [:graph/switch (:repo data) {:rtc-download? true}])) (defmethod handle :rtc-sync-state [_ _worker data] (let [state data]