mirror of https://github.com/logseq/logseq
fix: create rtc graph
parent
21bfece777
commit
b423b52379
|
@ -320,11 +320,12 @@
|
||||||
(if (invalid-graph-name? @*graph-name)
|
(if (invalid-graph-name? @*graph-name)
|
||||||
(invalid-graph-name-warning)
|
(invalid-graph-name-warning)
|
||||||
(p/let [repo (repo-handler/new-db! @*graph-name)]
|
(p/let [repo (repo-handler/new-db! @*graph-name)]
|
||||||
|
(p/do!
|
||||||
(when @*cloud?
|
(when @*cloud?
|
||||||
(p/let [_create-result (rtc-handler/<rtc-create-graph! repo)
|
(p/do!
|
||||||
_start-result (rtc-handler/<rtc-start! repo)]
|
(rtc-handler/<rtc-create-graph! repo)
|
||||||
;; TODO: can't pr-str result
|
(rtc-handler/<rtc-start! repo)))
|
||||||
(state/close-modal!)))))))]
|
(state/close-modal!))))))]
|
||||||
[:div.new-graph.flex.flex-col.p-4.gap-4
|
[:div.new-graph.flex.flex-col.p-4.gap-4
|
||||||
[:h1.title.mb-4 "Create new graph: "]
|
[:h1.title.mb-4 "Create new graph: "]
|
||||||
[:input.form-input {:value @*graph-name
|
[:input.form-input {:value @*graph-name
|
||||||
|
|
|
@ -55,6 +55,6 @@
|
||||||
(js/console.error "Unexpected webworker error:" (-> data bean/->clj (get-in [:value :value])))
|
(js/console.error "Unexpected webworker error:" (-> data bean/->clj (get-in [:value :value])))
|
||||||
(js/console.error "Unexpected webworker error:" data))
|
(js/console.error "Unexpected webworker error:" data))
|
||||||
(if (string? data)
|
(if (string? data)
|
||||||
(let [[e payload] (util/profile "UI read transit: " (ldb/read-transit-str data))]
|
(let [[e payload] (ldb/read-transit-str data)]
|
||||||
(handle (keyword e) wrapped-worker payload))
|
(handle (keyword e) wrapped-worker payload))
|
||||||
(js/console.error "Worker received invalid data from worker: " data))))))))
|
(js/console.error "Worker received invalid data from worker: " data))))))))
|
||||||
|
|
|
@ -1123,10 +1123,12 @@
|
||||||
(when reset-*state?
|
(when reset-*state?
|
||||||
(reset! *state state)
|
(reset! *state state)
|
||||||
(swap! *state update :counter inc))
|
(swap! *state update :counter inc))
|
||||||
(add-watch (:*rtc-state @*state) :update-rtc-state
|
(when-let [*rtc-state (:*rtc-state @*state)]
|
||||||
|
(add-watch *rtc-state
|
||||||
|
:update-rtc-state
|
||||||
(fn [_ _ _ _new]
|
(fn [_ _ _ _new]
|
||||||
(when (:*repo @*state)
|
(when (:*repo @*state)
|
||||||
(swap! *state update :counter (fnil inc 0)))))
|
(swap! *state update :counter (fnil inc 0))))))
|
||||||
state))))
|
state))))
|
||||||
|
|
||||||
(defn <start-rtc
|
(defn <start-rtc
|
||||||
|
@ -1186,8 +1188,9 @@
|
||||||
|
|
||||||
(add-watch *state :notify-main-thread
|
(add-watch *state :notify-main-thread
|
||||||
(fn [_ _ old new]
|
(fn [_ _ old new]
|
||||||
(when-let [repo @(:*repo new)]
|
(when-let [*repo (:*repo new)]
|
||||||
(let [new-state (get-debug-state repo new)
|
(let [repo @*repo
|
||||||
|
new-state (get-debug-state repo new)
|
||||||
old-state (get-debug-state repo old)]
|
old-state (get-debug-state repo old)]
|
||||||
(when (or (not= new-state old-state)
|
(when (or (not= new-state old-state)
|
||||||
(= :open (:rtc-state new-state)))
|
(= :open (:rtc-state new-state)))
|
||||||
|
@ -1195,5 +1198,5 @@
|
||||||
|
|
||||||
(add-watch op-mem-layer/*ops-store :update-ops-state
|
(add-watch op-mem-layer/*ops-store :update-ops-state
|
||||||
(fn [_ _ _ _new]
|
(fn [_ _ _ _new]
|
||||||
(when (:*repo @*state)
|
(when (and *state (:*repo @*state))
|
||||||
(swap! *state update :counter (fnil inc 0)))))
|
(swap! *state update :counter (fnil inc 0)))))
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
(defn post-message
|
(defn post-message
|
||||||
[type data]
|
[type data]
|
||||||
(when (exists? js/self)
|
(when (exists? js/self)
|
||||||
(.postMessage js/self (frontend.worker.util/profile "Worker write transit: " (ldb/write-transit-str [type data])))))
|
(.postMessage js/self (ldb/write-transit-str [type data]))))
|
||||||
|
|
||||||
(defn get-pool-name
|
(defn get-pool-name
|
||||||
[graph-name]
|
[graph-name]
|
||||||
|
|
Loading…
Reference in New Issue