Jelajahi Sumber

fix: start rtc if ws state is :closing

Tienson Qin 1 tahun lalu
induk
melakukan
e523407738

+ 3 - 1
src/main/frontend/components/repo.cljs

@@ -340,7 +340,9 @@
                                (state/set-state! :rtc/uploading? false)
                                 ;; No need to wait for rtc-start since it's a go loop that'll
                                 ;; return a value once it's stopped
-                               (and (rtc-handler/<rtc-start! repo) false))
+                               (and (p/do!
+                                     (rtc-handler/<rtc-stop!)
+                                     (rtc-handler/<rtc-start! repo)) false))
                               (p/catch (fn [error]
                                          (reset! *creating-db? false)
                                          (state/set-state! :rtc/uploading? false)

+ 1 - 1
src/main/frontend/worker/rtc/core.cljs

@@ -1129,7 +1129,7 @@
   [repo conn token dev-mode?]
   (go
     (if-let [graph-uuid (ldb/get-graph-rtc-uuid @conn)]
-      (do (assert (and (contains? #{:closed nil} (some-> @*state :*ws deref ws/get-state))
+      (do (assert (and (contains? #{:closed :closing nil} (some-> @*state :*ws deref ws/get-state))
                        (contains? #{:closed nil} (some-> @*state :*rtc-state deref)))
                   (str
                    "*state should be :closed"