fix: ensure all graphs are latest in those cases

1. upload a local graph
2. download a local graph
3. a remote graph has been deleted from another client
This commit is contained in:
Tienson Qin
2025-07-11 20:49:02 +08:00
parent 9ca7e45ec7
commit 2866d3baad
10 changed files with 74 additions and 36 deletions

View File

@@ -1,16 +1,21 @@
(ns frontend.worker.rtc.ws-util
"Add RTC related logic to the function based on ws."
(:require [cljs-http-missionary.client :as http]
[frontend.worker.rtc.db :as rtc-db]
[frontend.worker.rtc.exception :as r.ex]
[frontend.worker.rtc.malli-schema :as rtc-schema]
[frontend.worker.rtc.ws :as ws]
[frontend.worker.state :as worker-state]
[frontend.worker.util :as worker-util]
[goog.string :as gstring]
[logseq.graph-parser.utf8 :as utf8]
[missionary.core :as m]))
(defn- handle-remote-ex
[resp]
(when (= :graph-not-exist (:type (:ex-data resp)))
(rtc-db/remove-rtc-data-in-conn! (worker-state/get-current-repo))
(worker-util/post-message :remote-graph-gone []))
(if-let [e ({:graph-not-exist r.ex/ex-remote-graph-not-exist
:graph-not-ready r.ex/ex-remote-graph-not-ready
:bad-request-body r.ex/ex-bad-request-body