Browse Source

fix(rtc): don't setup ws before check

rcmerci 1 year ago
parent
commit
e2b53795ef
1 changed files with 13 additions and 12 deletions
  1. 13 12
      src/main/frontend/worker/rtc/core.cljs

+ 13 - 12
src/main/frontend/worker/rtc/core.cljs

@@ -1123,18 +1123,19 @@
 (defn <start-rtc
 (defn <start-rtc
   [repo conn token dev-mode?]
   [repo conn token dev-mode?]
   (go
   (go
-    (let [state (<! (<init-state repo token true {:dev-mode? dev-mode?}))
-          state-for-asset-sync (asset-sync/init-state-from-rtc-state state)
-          _ (reset! asset-sync/*asset-sync-state state-for-asset-sync)
-          config (worker-state/get-config repo)]
-      (if-let [graph-uuid (op-mem-layer/get-graph-uuid repo)]
-        (let [c1 (<loop-for-rtc state graph-uuid repo conn (common-config/get-date-formatter config))
-              c2 (asset-sync/<loop-for-assets-sync state-for-asset-sync graph-uuid repo conn)]
-          (<! c1)
-          (<! c2))
-        (worker-util/post-message :notification [[:div
-                                                  [:p "RTC is not supported for this graph"]]
-                                                 :error])))))
+    (if-let [graph-uuid (op-mem-layer/get-graph-uuid repo)]
+      (let [state (<! (<init-state repo token true {:dev-mode? dev-mode?}))
+            state-for-asset-sync (asset-sync/init-state-from-rtc-state state)
+            _ (reset! asset-sync/*asset-sync-state state-for-asset-sync)
+            config (worker-state/get-config repo)
+            c1 (<loop-for-rtc state graph-uuid repo conn (common-config/get-date-formatter config))
+            c2 (asset-sync/<loop-for-assets-sync state-for-asset-sync graph-uuid repo conn)]
+        (<! c1)
+        (<! c2))
+      (worker-util/post-message :notification
+                                [[:div
+                                  [:p "RTC is not supported for this graph"]]
+                                 :error]))))
 
 
 (defn stop-rtc
 (defn stop-rtc
   [state]
   [state]